Re: Toggling dark/light GUI mode / changing matplotlib style
Matt Newville <[email protected]> Sat, 5 Mar 2022 06:18:51 -0600
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <CA+7ESbpNMSMa5hLQBF7QQc0djNQS_+83GEnWq8dD19HyiHuq8w@mail.gmail.com> |
--0000000000007c7d9305d977a40d Content-Type: text/plain; charset="UTF-8" On Sat, Mar 5, 2022 at 2:07 AM Matthias Brennwald <[email protected]> wrote: > > > On Fri, Mar 4 2022 at 22:24:17 -0600, Matt Newville < > [email protected]> wrote: > > ... One of the things it supports is setting one of matplolib's color > themes (including many from seaborn). This essentially sets the matplotlib > rcParams settings and sets the colors of the various plot components. > > > Sure. That's exactly what I am already doing now (use rcParams to set the > plot style). However, according to the matplotlib documentation, changing > the plot styles (via rcParams) of an existing plot does not work. Setting > the plot styles using rcParams will therefore only work at startup, when > the figure is created, but it does not allow changing the plot style if the > GUI light/dark mode is changed *after* the figure has been created. > Sorry to repeat myself but: a) providing example code would clarify what you are doing. b) wxmplot might do what you want. c) even if not, the wxmplot code will show you an example of one way this can be done. d) wxmplot sets rcParams **and** sets the colors of the plot components. See: https://github.com/newville/wxmplot/blob/master/wxmplot/config.py#L313 --Matt -- You received this message because you are subscribed to the Google Groups "wxPython-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/CA%2B7ESbpNMSMa5hLQBF7QQc0djNQS_%2B83GEnWq8dD19HyiHuq8w%40mail.gmail.com. --0000000000007c7d9305d977a40d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon= t-family:arial,sans-serif"><br></div></div><br><div class=3D"gmail_quote"><= div dir=3D"ltr" class=3D"gmail_attr">On Sat, Mar 5, 2022 at 2:07 AM Matthia= s Brennwald <<a href=3D"mailto:[email protected]">[email protected]</a= >> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px= 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><di= v id=3D"gmail-m_6318225154164708065geary-body" dir=3D"auto"><div><br></div>= </div><div id=3D"gmail-m_6318225154164708065geary-quote" dir=3D"auto"><br>O= n Fri, Mar 4 2022 at 22:24:17 -0600, Matt Newville <<a href=3D"mailto:ne= [email protected]" target=3D"_blank">[email protected]</a>&= gt; wrote:<br><blockquote type=3D"cite"><div dir=3D"ltr"><div dir=3D"ltr"><= div style=3D"font-family:arial,sans-serif">... One of the things it support= s is setting one of matplolib's=C2=A0color themes (including many from = seaborn).=C2=A0 This essentially sets the matplotlib rcParams settings and = sets the colors of the various=C2=A0plot components.</div></div></div></blo= ckquote><font face=3D"arial, sans-serif"><div><font face=3D"arial, sans-ser= if"><br></font></div><div><font face=3D"arial, sans-serif">Sure. That's= exactly what I am already doing now (use rcParams to set the plot style). = However, according to the matplotlib documentation, changing the plot style= s (via rcParams) of an existing plot does not work. Setting the plot styles= using rcParams will therefore only work at startup, when the figure is cre= ated, but it does not allow changing the plot style if the GUI light/dark m= ode is changed *after* the figure has been created.</font></div></font></di= v></blockquote><div><br></div><div class=3D"gmail_default" style=3D"font-fa= mily:arial,sans-serif">Sorry to repeat myself but:=C2=A0</div><div class=3D= "gmail_default" style=3D"font-family:arial,sans-serif">=C2=A0 =C2=A0a) prov= iding example code would clarify what you are doing.=C2=A0</div><div class= =3D"gmail_default" style=3D"font-family:arial,sans-serif">=C2=A0 =C2=A0b) w= xmplot might do what you want.</div><div class=3D"gmail_default" style=3D"f= ont-family:arial,sans-serif">=C2=A0 =C2=A0c) even if not, the wxmplot code = will show you an example of one way this can be done.=C2=A0</div><div class= =3D"gmail_default" style=3D"font-family:arial,sans-serif">=C2=A0 =C2=A0d) w= xmplot sets rcParams **and** sets the colors of the plot components.</div><= div class=3D"gmail_default" style=3D"font-family:arial,sans-serif"><br></di= v><div class=3D"gmail_default" style=3D"font-family:arial,sans-serif">See: = <a href=3D"https://github.com/newville/wxmplot/blob/master/wxmplot/config.p= y#L313">https://github.com/newville/wxmplot/blob/master/wxmplot/config.py#L= 313</a></div><div class=3D"gmail_default" style=3D"font-family:arial,sans-s= erif"><br></div></div><div dir=3D"ltr" class=3D"gmail_signature"><div dir= =3D"ltr">--Matt=C2=A0<br></div><div dir=3D"ltr"><br></div></div></div> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;wxPython-users" group.<br /> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]">wxpy= [email protected]</a>.<br /> To view this discussion on the web visit <a href=3D"https://groups.google.c= om/d/msgid/wxpython-users/CA%2B7ESbpNMSMa5hLQBF7QQc0djNQS_%2B83GEnWq8dD19Hy= iHuq8w%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://gro= ups.google.com/d/msgid/wxpython-users/CA%2B7ESbpNMSMa5hLQBF7QQc0djNQS_%2B83= GEnWq8dD19HyiHuq8w%40mail.gmail.com</a>.<br /> --0000000000007c7d9305d977a40d--