How do I plot in AITOFF for values of x and y
And then superimpose another set of x and y values with different color. Can you send me the code to plot
I have tried subplot but not working
Related
I have a pandas data frame where x axis has continuous values and y axis has ones and zeros. How should I make a bar plot so that the x axis has bins like 5-10 10-15 ,.... and y axis represents the no of ones and zeros =, i.e there are 100 ones when x is between 5-10
I tried the following method
ax = df.plot.bar(x='PAY',Y='ACCEPTED')
Here Y is categorical
I got the error
No numeric data to plot
At the moment I have the following scatter plot in Matplotlib Python:
I also have about 7 other similar scatter plots but with slightly different z (colour) values but test the same x and y values all stored in json files.
I was wondering if there was an algorithm/function I can use to find the optimal average x and y values such that the z value (colour) is maximized on average out of all my scatter plots, since the values aren't very consistent and vary between scatter plots quite a lot.
(or even just the optimal values of a single scatter plot would suffice as I could combine them into a single one)
Just one idea. I think this can be achieved as regression task. Target value could be the norm of z values at each point(x, y).
I want to draw multiple plots in the same plot so I took 2d list in which for one parameter it's storing the values in the string format and I am using the for loop for the same but when I am plotting the larger values on y axis are coming below the smaller values
Here is the code snippet that might help to understand
m=['H','.','<','^','*','+','x','#']
cnt=0
for i in all:# here all has the row wise data to plot
matplotlib.pyplot.plot(l3,i,m[cnt])# l3 contains the values about the x axis
cnt=cnt+1
plt.xlabel("x")
plt.ylabel("y")
plt.legend(para,loc='best')# para contains the info about the y parameters
plt.show()
The graph is coming like this how to get 12000 above 0 in the graph
This is the plot I got how to rescale it so that all values comes in acsending order on y axis
You have to convert strings to floats before plotting
for i in all:# here all has the row wise data to plot
y = [float(ii) for ii in i]
matplotlib.pyplot.plot(l3, y, m[cnt])# l3 contains the values about the x axis
cnt=cnt+1
I have plotted a boxplot using seaborn, the y axis is uses a log scale (time in miliseconds). I would like to make the y axis more clear by including more values on the axis. How could I achieve that? The code used and the graph generated are below.
ax2 = sns.boxplot(x="xVals", y="Time", data=df2, whis=[0, 100])
ax2.set(yscale="log")
Try
ax2.xaxis.set_major_locator(ticker.MultipleLocator(5))
ax2.xaxis.set_minor_locator(ticker.MultipleLocator(1))
More info:
https://matplotlib.org/api/ticker_api.html
I want to plot an histogram in python 2.7 whith a log scale on y axis:
I wrote this code:
plt.hist(lifes,100, log=True)
But the results of histogram changed for the two axis like this:
But in the initial histogram I have values > 2000 for x axis and all values are smaller than 200 for y axis.
I think it is because some values on x axis have one as effectif?