axis

How to create a pandas density plot with datetime.date on the x-axis

How to create a pandas density plot with datetime.date on the x-axis Question: #dataframe a= timestamp count 2021-08-16 20 2021-08-17 60 2021-08-18 35 2021-08-19 1 2021-08-20 0 2021-08-21 1 2021-08-22 50 2021-08-23 36 2021-08-24 68 2021-08-25 125 2021-08-26 54 I applied this code a.plot(kind="density") this is not what i want. I want to put Count …

Total answers: 1

Axes class – set explicitly size (width/height) of axes in given units

Axes class – set explicitly size (width/height) of axes in given units Question: I want to to create a figure using matplotlib where I can explicitly specify the size of the axes, i.e. I want to set the width and height of the axes bbox. I have looked around all over and I cannot find …

Total answers: 4

How to share x axes of two subplots after they have been created

How to share x axes of two subplots after they have been created Question: I’m trying to share two subplots axes, but I need to share the x axis after the figure was created. E.g. I create this figure: import numpy as np import matplotlib.pyplot as plt t = np.arange(1000)/100. x = np.sin(2*np.pi*10*t) y = …

Total answers: 5

How to hide ticks label in python but keep the ticks in place?

How to hide ticks label in python but keep the ticks in place? Question: I want to hide my ticks label on a plot I created, but keep this tick itself (the little marks on the axis). When I try to use what I’ve found here, for example, the entire tick is removed, and not …

Total answers: 4

Drawing average line in histogram (matplotlib)

Drawing average line in histogram (matplotlib) Question: I am drawing a histogram using matplotlib in python, and would like to draw a line representing the average of the dataset, overlaid on the histogram as a dotted line (or maybe some other color would do too). Any ideas on how to draw a line overlaid on …

Total answers: 3

matplotlib (equal unit length): with 'equal' aspect ratio z-axis is not equal to x- and y-

matplotlib (equal unit length): with 'equal' aspect ratio z-axis is not equal to x- and y- Question: When I set up an equal aspect ratio for a 3d graph, the z-axis does not change to ‘equal’. So this: fig = pylab.figure() mesFig = fig.gca(projection=’3d’, adjustable=’box’) mesFig.axis(‘equal’) mesFig.plot(xC, yC, zC, ‘r.’) mesFig.plot(xO, yO, zO, ‘b.’) pyplot.show() …

Total answers: 10

Secondary axis with twinx(): how to add to legend?

Secondary axis with twinx(): how to add to legend Question: I have a plot with two y-axes, using twinx(). I also give labels to the lines, and want to show them with legend(), but I only succeed to get the labels of one axis in the legend: import numpy as np import matplotlib.pyplot as plt …

Total answers: 11