0

I am trying to draw a curve without a line (skeleton). I want the axis and grid lines only.

Here is the code. ++++++++++

import matplotlib.pyplot as plt

import numpy as np

plt.rcParams["figure.figsize"] = [10.00, 7.00]
plt.rcParams["figure.autolayout"] = True

x = [1.6,2,2.5,3.2,4,5,6.3,8,10,13,16,20,25,32,40,50,63,80,100,130,160,200,250,320,400,500,630,800,1000]
y = range(1,10000,350)#[1,10,100,1000,10000]

# Display grid
plt.grid(True, which="both")

default_x_ticks = range(len(x))
plt.plot(default_x_ticks, y)
plt.yscale('log')
plt.xticks(default_x_ticks, x, rotation=90)
plt.show()

+++++++ Kindly help draw without the curve.

1 Answers1

0

By adding

print(plt.xlim())
print(plt.ylim())

to your code you get the exact axis limits. These can be used in a second run to create the plot without actually plotting anything:

import matplotlib.pyplot as plt

import numpy as np

plt.rcParams["figure.figsize"] = [10.00, 7.00]
plt.rcParams["figure.autolayout"] = True

x = [1.6,2,2.5,3.2,4,5,6.3,8,10,13,16,20,25,32,40,50,63,80,100,130,160,200,250,320,400,500,630,800,1000]
y = range(1,10000,350)#[1,10,100,1000,10000]

# Display grid
plt.grid(True, which="both")

default_x_ticks = range(len(x))
# plt.plot(default_x_ticks, y)
plt.yscale('log')
plt.xticks(default_x_ticks, x, rotation=90)

plt.xlim(-1.4, 29.4)
plt.ylim(0.6315917965717447, 15517.934294269562)
plt.show()
Flow
  • 551
  • 1
  • 3
  • 9
  • The above code worked. This is what I am trying to come up with. https://drive.google.com/file/d/1GHStmSUHqRjsGQqXTlSLXOnLkkdoDz8_/view?usp=sharing The above link is for the image of the graph. – Bernard Ngoruse Oct 26 '22 at 06:31