All Questions
551 questions
2
votes
2
answers
73
views
Data apparently plotted wrong way on matplotlib
I am plotting a graph with date on the x axis and data on the y axis. However the graph is completly wrong and I don't understand why...
df['Date_TrailClean'] = pd.to_datetime(df['Date_TrailClean'])
# ...
1
vote
1
answer
68
views
plot modification to align both x-axes and start from where it exists in list
import matplotlib.pyplot as plt
size = 18
value = [20, 25, 30, 35]
x_values1 = list(range(0, 100, 5))
x_values2 = [0.0, 20.0, 40.0, 60.0, 80.0, 90.0, 95.0]
x_values3 = [80,76,72,68,64,60,56,52,48,44,...
0
votes
0
answers
29
views
How to resize twin axis matplotlib
I'm trying to overlay two figures in a plot, but when I use the twin axes as default, the resulting plot doesn't make much sense. I need to move the second figure (the one to be overlaid) to the top ...
0
votes
1
answer
40
views
changing the y axis in matplotlib
How can you change the y-axis in matplotlib such that you have specified ticks ([0, -1, -8, -44, -244]) but they are evenly spread over the y-axis (the gap between 0 and -1 is just as big as the gap ...
0
votes
2
answers
32
views
Rescale axes concerning visible artists only
I have a request regarding the use of autoscale_view(). I was expecting it to scale the plot considering only the visible artists, but it does not have such an effect.
I have a small test script as ...
1
vote
0
answers
81
views
Rotating matplotlib subplot with additional axes
I am currently struggling to create a 3-panel figure where the centre plot contains a contour plot and the top left and right panels show some lines. The thing is that all the plots are rotated 45 ...
0
votes
1
answer
39
views
Excluding a label on the y-axis in Matplotlib: How?
I would not like to have the first label on the y-axis on my figure which looks like this now, since I don't find it very nice to have it like this.
In my solution, I tried excluding the ...
1
vote
0
answers
33
views
Display custom dates on x axis matplotlib
Here is my plot:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.dates as mdates
dates = pd.date_range('2020-03-31', '2024-06-30', freq='...
0
votes
1
answer
80
views
When using matplotlib, how do I set the on-screen lengths of the x and y axes to be equal without changing the limits of either axis?
I would like to make the axes of a matplotlib plot a square, and do so by stretching or compressing the scaling of the axes rather than by changing the axis limits. How can this be done?
(In other ...
0
votes
0
answers
44
views
How can I format tickers for hh:mm in Python matplotlib over a fixed period
I am fairl amateur to programming, but I'm trying to create a python widget that can display the selected photoperiod for a controlled environment growhouse, based on the current time. A GUI would ...
2
votes
1
answer
49
views
unexpected reversed secondary y axis on dataframe plot
I'm trying to plot a electrical consumption, first in mA with a date, and with secondary axis in W with julian day.
I refered to this matplotlib article, and even if the example works perfectly, I can'...
1
vote
1
answer
36
views
Applying identical axis format to all subplots
I'm building 5 subplots in a Figure, so that the larger sublot fig_1 occupies [rows_0, cols_0:3] of the Figure, and smaller sublots fig_2-fig_5 occupy [rows_1, cols_0-cols_3] of the Figure.
How could ...
0
votes
1
answer
34
views
Weird margins when using curvilinear axis
This example comes from Matplotlib's documentation. I'm running it inside Jupyter Lab. Here I attach the output figure:
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.projections ...
4
votes
2
answers
365
views
How to use multiple xticks/axis labels at different orientations to group together subgroups?
I have written a Python script (below) to produce a Matplotlib plot to display boxplot data grouped together by subgroups (season), groups (city), and different colors (year).
However, the group (city)...
1
vote
1
answer
76
views
Grid based on 1. y-axis with 2. x-axis is shown in matplotlib
For my students I need a blanked plot with 2 x-axis and 2 y-axis. For a better workflow there is a grid based on 1st x-axis and 1st y-axis so they can easily copy the data from the machine by hand. On ...