mark a number on plot axis - R plot - r

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!

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.

How to know number of bars beforehand in Pygal?

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!

R Plotly - Mirroring y axes

is it possible to "mirror" the y axis with R plotly ? I would like to do something similar to this, but with a mirrored y-axis, in order to plot 2 by 2 some data, one replicate one the regular yaxis, and the other on the mirrored axis (that would prevent me to convert a half of my data to negative values).
Also, if possible, I want the bars to be on the same place (one right under the other), not on two distinct sides like showed in the link.
Thanks in advance.

Resizing plots in plotly (R)

Sorry if this question has already been answered but I can't find a solution.
I have a data frame which is imported from a .csv file. It has four columns. I want to plot a 3d scatter plot of the first two columns against the last column using Plotly.
The problem is that for some reason, the scatter plot does not automatically resize its axes to fit the plot space. So in this case I end up with a tall thin plot. The weird thing is that if I do an example with some random numbers, I don't get this problem.
Can anyone help me to get my scatter plot to fit to the window?
My data can be found at https://www.dropbox.com/s/ojwrezjker33x2b/Data.csv?dl=0
Basically I want to do:
library(plotly)
X<-read.csv("Data.csv")
plot_ly(x=X[,1],y=X[,2],z=X[,4],type='scatter3d',mode='markers')
And this results in a tall and thin scatter plot (sorry can't post an image cos I am new to the site).
I would like this to be a well-proportioned scatter plot that fits the window.
Thanks for any help.
The default setting for aspectmode is 'auto' and Plotly will try to keep the relative axis lenghts equal.
If you set aspectmode='cube' you should get a plot with identical absolute axes lengths.
plot_ly(x=X[,1],y=X[,2],z=X[,4],type='scatter3d',mode='markers') %>%
layout(scene=list(aspectmode='cube'))

space points in a scatter plot in R

I am plotting a scatter plot in R, however I have many data points and they overlap. I want to have a plot where there no overlaps and maintain a reasonable size of the data . This is the image of the scatter. On the top side is where the data are clustered.
This is the code plot(data2,col="red",pch=21,cex=0.7)
Could you put a reproducible code to check.
One thing you can do is may be increase the space between y axis interval.

Resources