Coder Social home page Coder Social logo

[Help Request]: I am only getting ticks on the right and top of my plots, also the colors of the lines are odd about scienceplots HOT 6 CLOSED

tomasrojasc avatar tomasrojasc commented on May 31, 2024 1
[Help Request]: I am only getting ticks on the right and top of my plots, also the colors of the lines are odd

from scienceplots.

Comments (6)

tomasrojasc avatar tomasrojasc commented on May 31, 2024 1

Thank you very much for your help and fast responses!

from scienceplots.

echedey-ls avatar echedey-ls commented on May 31, 2024

I can´t reproduce, on Google Colab nor in VS Code. Can you provide your code editor? And do you mind double checking the output on a whole new and clean project/notebook?

It only comes to my mind that your environment sets matplotlib to use a style that by default.
Btw, try updating matplotlib and the ipython kernels.

EDIT: can you show the output without any styles applied?

from scienceplots.

tomasrojasc avatar tomasrojasc commented on May 31, 2024

Hi, yes something is odd, without any styles I get this: https://imgur.com/a/Wpfwvq6

Which seems the default seaborn template... although I haven't even imported seaborn.

EDIT: I am using kedro as framework and pycharm as editor

from scienceplots.

echedey-ls avatar echedey-ls commented on May 31, 2024

Two things:

  1. You can call mpl.rcParams or plt.rcParams and that will throw the dictionary with all config from the applied styles. Unluckily matplotlib does not save your current styles.
    Call that from a terminal and from inside PyCharm without making use of plt.style.use(...). That way you can compare both and tell if PyCharm is introducing its styles by default. You may want to use an script to compare those dictionaries. And if you think seaborn matches that, import it with the use statement and check.
  2. You can set default values for rcParams with:
    import matplotlib as mpl
    mpl.rcParams.update(mpl.rcParamsDefault)
    (reference)

If you find something or this works, pls, let us know!

from scienceplots.

tomasrojasc avatar tomasrojasc commented on May 31, 2024

Apparently PyCharm does introduce an style, I have it almost working, what I done is I first set the default config of matplotlib, then the science style, and now I get this: https://imgur.com/a/AwHOcFY

So now I am only missing the colors! Hopefully, although after I have more complex plots that may introduce styles since I heavily rely on seaborn... But one step at a time.

from scienceplots.

echedey-ls avatar echedey-ls commented on May 31, 2024

Nice! I'll close this issue since the main problem has been solved.

science style does indeed change the default colors via plt.rcParams['axes.prop_cycle'].

plt.rcParams['axes.prop_cycle'] = plt.rcParamsDefault['axes.prop_cycle']

And see this comment.

from scienceplots.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.