Python Forum
Pyplot line color and spacing/padding
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pyplot line color and spacing/padding
#1
Dear Python Experts,

I have prepared a chart and just some visual upgrades in mind
I wonder why the chart goes beyond the maximum values given and
why there is a gap in the left corner.

fig1, ax1 = plt.subplots(figsize=(8, 4))
timeaxis = [2020, 2030, 2040, 2050, 2060]
s1 = [2578,2819,3060,3301,3542]
ax1.plot(timeaxis, s1, 'c-')
ax1.set_xlabel('Year')
# Make the y-axis label, ticks and tick labels match the line color.
ax1.set_ylabel('No. of pages in Federal Law Gazette', color='black')
ax1.tick_params('y', colors='black')
ax1.spines['top'].set_visible(False)
ax1.spines['right'].set_visible(False)
fig1.tight_layout()
plt.xticks(np.arange(min(timeaxis), max(timeaxis)+1, 10.0))
Finally, when I try to write "gray" or give a HEX code instead of 'g' for green an error is thrown.
How can I be more creative with the colors I use for the line chart?

Many thanks for any hints.

Attached Files

Thumbnail(s)
   
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Spacing/Formatting Hendrixson29 2 2,956 Aug-31-2020, 07:40 PM
Last Post: bowlofred
  Output String Padding help northduckota 3 2,269 Nov-15-2019, 02:20 PM
Last Post: perfringo
  Issues with matplotlib.pyplot schniefen 2 2,284 Apr-19-2019, 11:51 AM
Last Post: schniefen
  How to customize x axis in matplotlib.pyplot for a scatter plot? wlsa 9 8,200 Nov-10-2018, 01:32 AM
Last Post: wlsa
  How to create custom error bars in matplotlib.pyplot? wlsa 1 4,255 Nov-04-2018, 09:49 PM
Last Post: wlsa

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020