Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Matplotlib scientific axis notation (exponential) fails to reappear #13638

Copy link
Copy link
Closed
@WhatWheatleySaid

Description

@WhatWheatleySaid
Issue body actions

Bug report

Not sure if its the TK backend or matplotlib, but I couldn't reproduce this without TK. When you set the visibillity of the ticklabels to False and then to True again and exponential shift is active, the exponent ( in this case 1e9) disappears for the corresponding axis but does not reappear with visibile=True

when you try to draw what the example shows without TK embedding and just set visible= False and True again, the ticklabels actually disappear too

Code for reproduction

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import tkinter
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
class app:
    def __init__(self,master):
        self.master = master
        self.fig = plt.figure()
        self.canvas = FigureCanvasTkAgg(self.fig, master=self.master)
        self.ax = self.fig.gca(projection = '3d',proj_type = 'ortho')
        self.canvas.get_tk_widget().pack()
        self.master.protocol("WM_DELETE_WINDOW", self.on_closing)
        self.ax.plot([-1e9,1e9],[-1e9,1e9],[-1e9,1e9])
        tkinter.Button(master=self.master,text='TOP', command=self.change_view).pack()
        self.view_cid = None

    def change_view(self):
        self.ax.view_init(90,-90)
        self.axis_visibility(event = None,visible=False)
        self.view_cid = self.fig.canvas.mpl_connect('draw_event',lambda event: self.axis_visibility(event,visible=True))
        self.canvas.draw()

    def axis_visibility(self,event,visible):
        self.ax.set_zticklabels(self.ax.get_zticklabels(),visible=visible)
        if self.view_cid != None:
            self.fig.canvas.mpl_disconnect(self.view_cid)

    def on_closing(self):
        self.master.quit()

if __name__ == '__main__':
    root = tkinter.Tk()
    gui = app(root)
    root.mainloop()

Actual outcome

https://imgur.com/VnyOBaj

Expected outcome
https://imgur.com/3UB1rIk

  • Operating system: Ubuntu 18.04 LTS
  • Matplotlib version: 3.0.3
  • Matplotlib backend: TkAgg
  • Python version: 3.6.7
  • Other libraries: -

i used pip3 to install matplotlib

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.