I want to plot bar chart for some parameters for men and women. I have done like this:
I want to show the frequency for mean in upper side (positive y axis) and for women in lower side (negative x-axis). In this case, for frequency only the magnitude matter and sign does not. Just for convenience I am showing one in upper side and another in lower side. Can I change the labeling (-5, -10, ... here) in negative y-axis so that their magnitude remain same but all are positive (5, 10,...) . Now there should be two positive y-axis , one mirror image of other.
To switch the axes of the plot, set x_data and y_data of the axis 1 curve to axis 2 curve. Adjust the padding between and around the subplots. To display the figure, use show() method.
The plt. axis() method allows you to set the x and y limits with a single call, by passing a list which specifies [xmin, xmax, ymin, ymax] : In [11]: plt.
Generally, the scatter plot is plotted on the positive values, but what happens when the dataset has both negative and positive values. So in this article, we are creating the scatter plot with both negative and positive axes.
Sure it can be done. Here's an example that you can play around with:
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111)
x = np.linspace(0, 2*np.pi, 100)
y = np.sin(x)
ax.plot(x,y)
ax.set_yticklabels([str(abs(x)) for x in ax.get_yticks()])
ax.show()
Here I just set the yticklabel to be the absolute value of the y position. Of course, I have symmetric data and you don't. If you want it to be "mirrored" down the middle, you'll need to set an explicit y range with ax.set_ylim
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With