Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8247177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:45:20+00:00 2026-06-07T22:45:20+00:00

I have a plot in a tkinter.Toplevel window and I would like to have

  • 0

I have a plot in a tkinter.Toplevel window and I would like to have it use a custom spaced x-axis. Currently it is set as default so the numbers are evenly spaced (0,5,10,15… etc.). I would like to have a tick mark for each data point I have (example 2,6,15,30). I am sure it is just some key word under some header, but I cannot figure out which one it is. Below is an example of the code that it would be going into.

import matplotlib
matplotlib.use('TkAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.backends.backend_tkagg import NavigationToolbar2TkAgg
from matplotlib.figure import Figure
import Tkinter as tk

root = tk.Toplevel(width=2000)
f = Figure()
ax = f.add_subplot(111)
zeroy = [0,25]
zerox = [0, 35]
p3 = ax.plot(zerox, zeroy, 'k-')
canvas = FigureCanvasTkAgg(f, master=root)
canvas.show()
canvas.get_tk_widget().grid(row=0)

toolbar = NavigationToolbar2TkAgg(canvas, root)
toolbar.grid(row=1, sticky=tk.W) 
toolbar.update() 
button = tk.Button(root, text='Quit', command = root.destroy)
button.grid(row=2)
root.mainloop()

I have tried to use ax.xticks(...) and f.add_axes(xticks=[1,2,5,7] but these didn’t work. I have also tried a variety of other weak attempts without success. Any help would be appreciated. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T22:45:22+00:00Added an answer on June 7, 2026 at 10:45 pm
    ax.set_xticks(ticks=[0,2,4,5,30,50])
    

    Discovered this after messing with my code some more.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a plot in which I'd like many ticks along the x-axis, yet
I have a density plot and I would like to add some summary information
I would like to have a plot in R similar to the 2D smoothScatter
I have to plot some plot(x,y) scatters, but i would like the points to
I have a plot that has $-amounts and dates on y and x axis
I have a plot that has data that runs into the area I'd like
I have a plot like this: https://i.stack.imgur.com/zdike.png I need the data coordinates of points
I have a plot which has timestamps on the x-axis and some signal data
i have a plot looking like this: However the lines are overlapping quite a
I have a plot with overlapping shaded confidence intervals that looks like this: and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.