Python Forum
Plotting “simple” diagram with gridlines at specified intervals
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plotting “simple” diagram with gridlines at specified intervals
#1
I’d like to plot a diagram according to the sketch in the link. The lines emanating from the y-axis should be dotted, and the boxes above the x-axis are supposed to be squares. The square enclosed by the dotted lines and the non-dotted line should be shaded. Preferably with the labels “bin j” and “bin i” as well. Is this possible to plot with specifying gridlines at specific intervals?

[Image: 3hDAEVt]

https://imgur.com/3hDAEVt
Reply
#2
(Dec-03-2020, 11:46 AM)schniefen Wrote: I’d like to plot a diagram according to the sketch in the link. The lines emanating from the y-axis should be dotted, and the boxes above the x-axis are supposed to be squares. The square enclosed by the dotted lines and the non-dotted line should be shaded. Preferably with the labels “bin j” and “bin i” as well. Is this possible to plot with specifying gridlines at specific intervals?

[Image: 3hDAEVt]

https://imgur.com/3hDAEVt
import matplotlib.pyplot as plt

fig, ax= plt.subplots()
ax.plot()
ax.axvspan(0.4,0.6,ymin=0.6,ymax=0.8,alpha=0.5,color='grey')
ax.set_xlim(0,1)
ax.set_ylim(0,1)
ax.set_xlabel('x',horizontalalignment='right', x=1.0)
ax.set_ylabel('z',horizontalalignment='right', y=1.0)
ax.vlines([0.4,0.6],0,1)
ax.hlines([0.2,0.4],0.4,0.6)
ax.hlines([0.6,0.8],0,1)
ax.text(0.5, -0.1, 'bin $i$', horizontalalignment='center', verticalalignment='center', transform=ax.transAxes)
ax.text(-0.1, 0.7, 'bin $k$', horizontalalignment='center', verticalalignment='center', rotation='vertical', transform=ax.transAxes);
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Better python library to create ER Diagram by using pandas data frames as tables klllmmm 0 1,098 Oct-19-2023, 01:01 PM
Last Post: klllmmm
  Generating classes diagram from source code Pavel_47 3 5,612 Oct-01-2021, 03:31 AM
Last Post: Lou
  Plotting simple graph (AttributeError) Laplace12 0 1,367 Jul-28-2021, 10:58 AM
Last Post: Laplace12
  Plotting sum of data files using simple code Laplace12 3 3,036 Jun-16-2021, 02:06 PM
Last Post: BashBedlam
  time intervals project_science 7 2,933 Feb-06-2021, 11:49 PM
Last Post: project_science
  Block diagram library marcocod 7 6,188 Nov-13-2020, 11:04 AM
Last Post: marcocod
  Setting Tick Intervals In Sub Plots JoeDainton123 1 1,789 Oct-03-2020, 11:52 PM
Last Post: scidam
  Simple plotting from txt file Laplace12 2 2,261 Aug-23-2020, 09:58 AM
Last Post: Laplace12
  Help Grouping by Intervals on list paul41 1 2,110 Dec-03-2019, 09:43 PM
Last Post: michael1789
  Grouping a list of various time into intervals paul41 1 3,770 Nov-24-2019, 01:47 PM
Last Post: buran

Forum Jump:

User Panel Messages

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