Python Forum
Getting proper x,y axis values
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting proper x,y axis values
#2
Why? Normally axis labels indicate range with maybe some subdivisions to give approximate value. If you want the real value you click on the plot.

You can tell matplotlib where to put tickmarks like this:
import numpy as np
import matplotlib.pyplot as plt
from math import sin

x = np.linspace(0.0, np.pi * 2, 100)
x1 = 1
y1 = sin(1)
x2 = 5
y2 = sin(5)

fig, ax = plt.subplots()
plt.plot(x, np.sin(x))
ax.set_xticks((x1, x2))
ax.set_yticks((y1, y2))
ax.grid(True)
plt.show()
Reply


Messages In This Thread
Getting proper x,y axis values - by pyhill00 - Jul-29-2022, 03:30 PM
RE: Getting proper x,y axis values - by deanhystad - Jul-29-2022, 04:05 PM
RE: Getting proper x,y axis values - by pyhill00 - Jul-29-2022, 04:43 PM
RE: Getting proper x,y axis values - by deanhystad - Jul-29-2022, 05:07 PM
RE: Getting proper x,y axis values - by pyhill00 - Jul-29-2022, 05:11 PM
RE: Getting proper x,y axis values - by deanhystad - Jul-29-2022, 05:49 PM
RE: Getting proper x,y axis values - by pyhill00 - Jul-29-2022, 05:57 PM
RE: Getting proper x,y axis values - by deanhystad - Jul-29-2022, 06:46 PM
RE: Getting proper x,y axis values - by pyhill00 - Jul-29-2022, 06:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pyserial issues with proper loops and binary jttolleson 16 2,793 Nov-02-2023, 08:39 PM
Last Post: deanhystad
  Print names in x-axis of a time-series values hobbyist 4 1,289 Apr-22-2023, 09:29 PM
Last Post: deanhystad
  ValueError: Length mismatch: Expected axis has 8 elements, new values have 1 elements ilknurg 1 5,320 May-17-2022, 11:38 AM
Last Post: Larz60+
  Proper way to do the OR statement? Mark17 5 1,815 Mar-01-2022, 01:54 PM
Last Post: Mark17
  Sample labels from excel file in order to put them on x-axis and y-axis of a plot hobbyist 11 4,521 Sep-14-2021, 08:29 AM
Last Post: hobbyist
  Put zero for x axis values quest 4 2,342 Jul-29-2021, 01:34 PM
Last Post: DeaD_EyE
  Difference Between Figure Axis and Sub Plot Axis in MatplotLib JoeDainton123 2 2,529 Aug-21-2020, 10:17 PM
Last Post: JoeDainton123
  proper use of 'end' in a 'with' statement ccrider27 1 2,100 Mar-18-2020, 10:33 PM
Last Post: buran
  Proper use of if..elif..else statement nick1941 2 2,450 Mar-06-2020, 11:22 PM
Last Post: nick1941
  Proper Layout of Code Question TheJax 2 2,244 Feb-08-2020, 06:14 PM
Last Post: TheJax

Forum Jump:

User Panel Messages

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