0

I have a 2d plot on the (x,y) plane, x range is [0,10], y range is [0,20]. The thickness of the curve is set to 2. Part of the curve lies along the y-axis. For this portion of the curve its thickness is almost 0. Basically, the y-axis is on top of it. I would like to have the curve on top of the axis not the other way round, and I do not want to change the x-axis range so that it starts at some negative value and I do not wish to increase the thickness of the curve or diminish the thickness of the axes if possible. (The reason for the latter is that I do not wish to give the impression that the curve strays into x<0, which in my application would be non-physical). Is there a way around this? This is not an issue, for example, with gnuplot.

x=[0, 0, 2, 1, 2, 3]
y=[1, 2, 1, 3, 4, 5]

import matplotlib.pyplot as plt
fig, axs = plt.subplots(1,1,zorder=1);
fig.set_figwidth(4);
fig.set_figheight(6);
axs.set_xlim(0.,3);
axs.set_ylim(0.,5);
axs.plot(x,y,'r-',lw=2,label='$4000$',zorder=3);
plt.show;

The part of the curve that consists of the first two points which lies along the vertical axis has a different thickness than the rest of the line.

dh16
  • 1
  • 1
    `axs.plot(x,y,'r-',lw=2,label='$4000$',clip_on=False)`? Also note that in Python, lines shouldn't end with semicolons (except maybe the last line in a notebook cell to prevent that the cells shows the return value of the last command). In `plot.show()` you forgot the `()`. – JohanC Nov 12 '22 at 21:52

0 Answers0