How to know number of bars beforehand in Pygal? - graph

When plotting a bar graph, for example, using pygal, I'd like to be able to know the number of bars the graph will have, in order to make a decision on whether or not the graph should be plotted.
Is there a way to do this?
Additionally, is there also a way to find out the number of slices in a pygal pie graph, and the number of points in a pygal line graph, before plotting them?
Thanks in advance!

Related

Jump y axis values when highest value is to far away from the other points

Basically I'm building an area graph with Chart.js, the data that I'm using in order to build the graph usually contains a peak that is much higher than the rest of the points and the y-axis range of values will be to high, to notice the diference between the lower points and it wil seem almost as a parallel line to the x-axis as we can see in this image:
Graph with problems
The solution I want to try is to skip the values from the y-axis between the lower points and the peak of the graph, and accomplish a graph presentation similar to this one:
Solution graph sketch
As we can see at this sketch the y-axis has a normal scale until 300 but then as the next point is to far away from the other ones the y-axis values are skiped.
So what I want to know is if this jump on the values of the y-axis is possible to achieve with this library (Chart.js) and if so where can I find documentation about it, because I already looked everywhere and couldn't find a thing. If not I would ask you for recommendations of any other librarys where I could achieve this.

mark a number on plot axis - R plot

I'd like to mark a number on the x-axis of a plot in R. For example, circle or highlight the number. Any idea of how to do it?
I was thinking of plotting a circle with a transparent background on the current plot. However, I couldn't find a way to do it right and exactly place it on the number I want which is below the x-axis.
Any help is appreciated!

Double opposite histogram in ggplot

I would like to know how to do this kind of graphs using ggplot :
https://image.noelshack.com/fichiers/2019/21/3/1558514850-plot-example2.png
This is an excel graph. I already know how to do each of the two histogram (left and right) but I don't know how to plot the two of them on the same graph, separated on the middle of the graph, with this duality.
Maybe using a specific package or geom I don't know yet ?
Thanks for help
You need to build your histogram with geom_col(), to have positive values for one groupe, négative values for the second groupe, and then use coord_split()

Is there a way to plot multiple plot types (i.e., bar chart and adjacent strip chart) on the same plot?

I'd like to display a bar plot with an adjacent series of strip charts, both with different y-axes, on the same overall plot. Can someone please suggest a way to to do this if possible?
The goal is to use a bar plot to show fold-change for qPCR, and then in the same figure show the individual dCt values for control and treatment groups that were used to generate the fold-change. The bar plot and strip chart need different y-axes.
Thank you for your help.

Mixed geom_line & geom_point plot: remove marker from color scale

I often have to use plots mixing lines and points (ggplot2), with the colors of the line representing one variable (here, "Dose"), and the shape of the points another one (here, "Treatment). Figure 1 shows what I typically get:
Figure 1: what I get
I like having different legends for the two variables, but would like to remove the round markers from the color scale, to only show the colors (see legend mockup below, made with Gimp). Doing so would allow me to have a clean legend, with colors and shapes clearly segregated.
Figure 2 (mockup): what I would like
Would anyone know if there is a way to do that? Any help would be much appreciated.
Note: the plots above show means and error bars, but I have the same problem with any plot mixing geom_line and geom_point, even simple ones.
Thanks in advance !

Resources