For plotting questions related to adjusting the y-axis.
Questions tagged [yaxis]
528 questions
881
votes
12 answers
How do I set the figure title and axes labels font size?
I am creating a figure in Matplotlib like this:
from matplotlib import pyplot as plt
fig = plt.figure()
plt.plot(data)
fig.suptitle('test title')
plt.xlabel('xlabel')
plt.ylabel('ylabel')
fig.savefig('test.jpg')
I want to specify font sizes for…

vasek1
- 13,541
- 11
- 32
- 36
652
votes
9 answers
How to set the axis limits
I need help with setting the limits of y-axis on matplotlib. Here is the code that I tried, unsuccessfully.
import matplotlib.pyplot as plt
plt.figure(1, figsize = (8.5,11))
plt.suptitle('plot title')
ax = []
aPlot = plt.subplot(321, axisbg = 'w',…

Curious2learn
- 31,692
- 43
- 108
- 125
139
votes
6 answers
How can I plot with 2 different y-axes?
I would like superimpose two scatter plots in R so that each set of points has its own (different) y-axis (i.e., in positions 2 and 4 on the figure) but the points appear superimposed on the same figure.
Is it possible to do this with plot?
Edit…

DQdlM
- 9,814
- 13
- 37
- 34
92
votes
4 answers
Barchart with vertical ytick labels
I'm using matplotlib to generate a (vertical) barchart. The problem is my labels are rather long. Is there any way to display them vertically, either in the bar or above it or below it?

phihag
- 278,196
- 72
- 453
- 469
79
votes
3 answers
seaborn heatmap y-axis reverse order
Have a look at
this
heatmap found in the seaborn heatmap documentation.
Right now the y-axis starts with 9 at the bottom, and ends with 0 on top.
Is there a way to turn this around, i.e. start with 0 at bottom and end with 9 at the top?

john kals
- 811
- 1
- 6
- 8
39
votes
5 answers
Setting the same axis limits for all subplots
This problem seems simple enough, but I can't find a pythonic way to solve it. I have several (four) subplots that are supposed to have the same xlim and ylim. Iterating over all subplots à la
f, axarr = plt.subplots(4)
for x in range(n):
…

MrArsGravis
- 568
- 1
- 4
- 9
35
votes
5 answers
Fixing x axis scale and autoscale y axis
I would like to plot only part of the array, fixing the x part, but letting the y part autoscale. I tried as shown below, but it does not work.
Any suggestions?
import numpy as np
import matplotlib.pyplot as…

Pygmalion
- 785
- 2
- 8
- 24
32
votes
3 answers
yaxis range display using absolute values rather than offset values
I have the following range of numpy data (deltas of usec timestamps):
array([ 4.312, 4.317, 4.316, 4.32 , 4.316, 4.316, 4.319, 4.317,
4.317, 4.316, 4.318, 4.316, 4.318, 4.316, 4.318, 4.317,
4.317, 4.317, 4.316, 4.317, …

David Poole
- 3,432
- 5
- 34
- 34
28
votes
2 answers
How to plot on secondary y-Axis with plotly express
How do I utilize plotly.express to plot multiple lines on two yaxis out of one Pandas dataframe?
I find this very useful to plot all columns containing a specific substring:
fig = px.line(df, y=df.filter(regex="Linear").columns,…

derflo
- 981
- 1
- 7
- 9
24
votes
2 answers
Combining Bar and Line chart (double axis) in ggplot2
I have double-y-axis chart made in Excel. In Excel it requires only basic skills. What I'd like to do is to replicate this chart using the ggplot2 library in R.
I have already done this, but I need to plot Response on 2nd-y-axis.
I enclose…

AK47
- 1,318
- 4
- 17
- 30
13
votes
2 answers
Aligning y-ticks to the left
I have tick labels of variable length, and I want to align them to the left (i.e. to have a space between the shorter ones and the y axis). Is there any reasonable way to do this?
Using horizontal alignment 'left' aligns them to the left, but they…

Korem
- 11,383
- 7
- 55
- 72
11
votes
1 answer
Adding second Y axis on ggplotly
I have created the following dataframe object and graph using plotly and ggplot
library(ggplot2)
library(plotly)
rdate <- function(x,
min = paste0(format(Sys.Date(), '%Y'), '-01-01'),
max = paste0(format(Sys.Date(),…

Raghavan vmvs
- 1,213
- 1
- 10
- 29
10
votes
4 answers
How to plot without extending axis limits
I'm trying to draw on an existing axis without extending or modifying its limits.
For example:
import numpy as np
import matplotlib.pyplot as plt
xy = np.random.randn(100, 2)
plt.scatter(xy[:,0], xy[:,1])
Makes a fine plot with well-fitting axis…

shadowtalker
- 12,529
- 3
- 53
- 96
10
votes
2 answers
Set ylim on subplot secondary y-axis
I want to plot the data in subplots using secondary axes. I can set the ylim but it affects only the secondary y-axis (on the right side). I can't find a way to control the ylim on the primary y-axis (on the left side). I'd like the primary y-axis…

user3508369
- 101
- 1
- 1
- 4
8
votes
2 answers
How to reverse secondary continuous_y_axis in ggplot2
I have a dataset I would like to graph with two Y-axes. The would like to reverse the secondary Y-axis so that it runs -60 to -40. The primary Y-axis should run 300-550. I cannot figure out how to reverse the secondary Y-axis without reversing the…

Christopher
- 83
- 5