I'd like to know how to find the value of the X axis, where the X and Y axes cross. The result is to be displayed in a cell. VB is optional.
Example
Where the arrow points is the value I would like to get.
From where the 60 in the Y axis crosses the points, I'd like to get the Y axis.
Related
I cannot work out how to apply a specific y axis range to my violin plot
current code is :
library(ggplot2)
X21$`gggnnn`<-as.factor(X21$`gggnnn`)
X21$`RTtype`<-as.factor(X21$`RTtype`)
bp<-ggplot(data=X21,aes(x=RTtype,y=RT,group=RTtype))+
geom_violin(aes(colour=RTtype),outlier.alpha = 1)+
facet_grid(.~gggnnn) +
labs(x="AM or PM", y='Reaction time /ms')+
geom_boxplot(width=0.1,colour="black",alpha=1,outlier.shape=4)+
ggtitle("AM and PM Reaction Time Distributions among Gamers and Non-gamers")+
geom_jitter(data=X21,aes(x=RTtype,y=RT,group=RTtype, colour=RTtype,shape=gggnnn))+
bp
this gives the plot as shown:
[1]:https://i.stack.imgur.com/3Aggm.png
I then tried to set y axis limits with adding a '+ylim(150,900)' , however this just truncated my data:
[2]:https://i.stack.imgur.com/kDiRs.png
I now see that this is a limit on the range of the data, not the values on the axis (i am looking for the y axis to go from 150 to 900, also i do not know how to change the y axis grid spacing, as it is currently in intervals of 250, which is harder to interperit, i would like to set this to 100.
I attempted to do this with '+scale_y_continuous(breaks = seq(150,900, by = 100))', However it had no effect on the plot
Any help would be much appreciated
datasheet format:
[3]: https://i.stack.imgur.com/iXKXF.png
in order to set y coordinate limits use
coord_cartesian(ylim = c(100,900))
generalised this is:
coordinates_cartesian(xlim = c(lower limit,upper limit), ylim( c =(lower,upper)
in order to set spacing use
scale_y_continuous(breaks = seq(100, 900, by = 200))
The description of the data frame
When I try to find the relationship between budget and revenue_of_investment
x = dfm_2.budget
y = dfm_2.revenue_of_investment
plt.figure(figsize = (10,8))
plt.xlim((40000,42500000))
plt.scatter(x,y)
The output is:
I know the range of the budget is big, but I do not figure out the data on the x-axis.
I even set the range, however, the x-axis doesn't fit the data.
If I understand your question correctly (i.e. that the plot is not displaying all of the data on the x-axis), it's because your upper xlim is too small.
The maximum value of dfm_2.budget is 4.25 * 1e8 (i.e. 425000000), but your xlim upper limit is set to 4.25 * 1e7 (i.e. 42500000) (i.e. you're missing a zero in your plt.xlim())
I am trying to hide any value on the y axis that is less than 0. I saw that to hide labels on the y axis I have to use something like this:
make_invisible = True
ax4.set_yticks(minor_ticks)
if (make_invisible):
yticks=ax4.yaxis.get_major_ticks()
yticks[0].label1.set_visible(False)
How can I tweak this so that if the ytick lable is negative it will be hidden?
You can use the set_xticks() method to simply set those ticks that you want on the x axis.
import matplotlib.pyplot as plt
plt.figure(figsize=(7,3))
plt.plot([-2,-1,0,1,2],[4,6,2,7,1])
ticks = [tick for tick in plt.gca().get_xticks() if tick >=0]
plt.gca().set_xticks(ticks)
plt.show()
Replacing every x by a y will give you the according behaviour on the y axis.
I am creating charts with origin(100,0) i.e, x axis value=100. At first I used,
ActiveChart.Axes(xlValue).MajorUnit = 10
and I got the x axis ... 70,80,90,100,110,120,130....etc
I thought it would be better if I had axis values as ...60,80,100,120,140... etc. So I edited my code as follows,
ActiveChart.Axes(xlValue).MajorUnit = 20
But now I am getting ...70,90,110,130... etc.
How can I get my x axis as ...60,80,100,120,140...?
Here's my problem, I'm making charts with the windows.forms.datavisualisation.charting library in a vb.net program.
I want my charts' X axis to always be the same length (pixel wise) because I'm lining them up vertically. The charts all have the same width and the X axis values are always the same (hours from 0 to 24).
The thing is the Y labels are not all in the same format. Some are integer representing a mass, some are percentage... Which makes the strings in each Y axis labels of different length
For example:
Chart1 Y axis labels: 0, 1 000 000, 2000 000, ..., 10 000 000...;
Chart2 Y axis: 2.33%, 3.45%...
They all have the same font and I would like to keep it like that if possible, but the length of the X axis is more important.
Any ideas? The following charts should help to explain:
First chart
Second Chart