<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mystique Lord</title>
    <description>The latest articles on DEV Community by Mystique Lord (@mystiquelord123).</description>
    <link>https://dev.to/mystiquelord123</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3717697%2F2db0e55b-e95b-4448-b539-f98733f2a231.jpg</url>
      <title>DEV Community: Mystique Lord</title>
      <link>https://dev.to/mystiquelord123</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mystiquelord123"/>
    <language>en</language>
    <item>
      <title>Converting the graphs into scientific styles</title>
      <dc:creator>Mystique Lord</dc:creator>
      <pubDate>Sat, 24 Jan 2026 11:46:36 +0000</pubDate>
      <link>https://dev.to/mystiquelord123/converting-the-graphs-into-scientific-styles-5ami</link>
      <guid>https://dev.to/mystiquelord123/converting-the-graphs-into-scientific-styles-5ami</guid>
      <description>&lt;p&gt;Hi everyone! In this article, we consider the SciencePlots library that allows us convert simple graphs into a scientific format. In this format, the graphs are displayed in some types of scientific articles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Initial actions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Installing
&lt;/h3&gt;

&lt;p&gt;Before using the SciencePlots library, we need to install it with the help of the commands according to your operating system.&lt;br&gt;
Windows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install SciencePlots
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;MacOS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip3 install SciencePlots
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Linux:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install SciencePlots
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also, we need to install the matplotlib library to create graphs. Commands to install the library are available below.&lt;br&gt;
Windows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install matplotlib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;MacOS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip3 install matplotlib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Linux:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install matplotlib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Preparing the data and writing the code
&lt;/h3&gt;

&lt;p&gt;Import the libraries:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import scienceplots
import matplotlib.pyplot as plt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As data, we take our information about Bitcoin’s worth in 2025:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bitcoin_prices = [102405.03, 84373.01, 82548.91, 94207.31, 104638.09, 107135.34, 115758.20, 108236.71, 114056.08,                      109556.16, 90394.31, 87263.99]

bitcoin_prices_labels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next step is to create our graph:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.plot(bitcoin_prices_labels, bitcoin_prices)
plt.title("Bitcoin prices in 2025")

plt.xlabel("Months")
plt.ylabel("Real prices ($)")
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here’s the full code; however, it will be the function called simple_graph():&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import scienceplots
import matplotlib.pyplot as plt


def simple_graph():
    bitcoin_prices = [102405.03, 84373.01, 82548.91, 94207.31, 104638.09, 107135.34, 115758.20, 108236.71, 114056.08,
                      109556.16, 90394.31, 87263.99]

    bitcoin_prices_labels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",  "Aug", "Sep", "Oct", "Nov", "Dec"]

    plt.plot(bitcoin_prices_labels, bitcoin_prices)
    plt.title("Bitcoin prices in 2025")

    plt.xlabel("Months")
    plt.ylabel("Real prices ($)")
    plt.show()


simple_graph()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now run the code in a way that we can see the graph without any styles:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn4mkfjziknass8rqlj36.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn4mkfjziknass8rqlj36.webp" alt=" " width="800" height="544"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Base styles
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Science style
&lt;/h2&gt;

&lt;p&gt;So, firstly, we consider the science style, but without a LaTeX font. To set the style, we need to define the style as the main style of our graph. We can do it with the help of the style package and use the use() function.&lt;br&gt;
Here’s the code example, where we set the styles:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.style.use(["science", "no-latex"])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the use() function, we define one or more styles, which are sets of visual attributes for graph elements. If we combine multiple styles in a single graph, we need to specify them as a list.&lt;br&gt;
So, our current code looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import scienceplots
import matplotlib.pyplot as plt


def simple_graph():
    plt.style.use(["science", "no-latex"])

    bitcoin_prices = [102405.03, 84373.01, 82548.91, 94207.31, 104638.09, 107135.34, 115758.20, 108236.71, 114056.08, 109556.16, 90394.31, 87263.99]

    bitcoin_prices_labels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

    plt.plot(bitcoin_prices_labels, bitcoin_prices)
    plt.title("Bitcoin prices in 2025")

    plt.xlabel("Months")
    plt.ylabel("Real prices ($)")
    plt.show()


simple_graph()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the code:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8odbhcx5kcc41122jan.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8odbhcx5kcc41122jan.webp" alt=" " width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  IEEE style
&lt;/h2&gt;

&lt;p&gt;The style makes the graph only with black and white colours.&lt;br&gt;
Set the style:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.style.use(["ieee", "no-latex"])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also, we should make one crucial change when we use the IEEE style. The style didn’t work correctly only with the common show() function, and that’s why we need to write the code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.rcParams.update(
        {"figure.dpi": "100"}
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code helps us to correctly set the graph settings. Without these settings, we can get the graph in an inappropriate, enormous size. Overall, the IEEE format was developed specifically for scientific magazines, and that’s the reason why the graphs are created in a tiny size. The development environment tries to resize the graphs, and as a result, we got enormous graphs.&lt;br&gt;
But if we define the DPI as 100 (Dots Per Inch), the graph will convert into a larger quantity of pixels, which makes the image’s quality much better.&lt;br&gt;
So, in the result, we’ll get the graph:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy5600r4e1z6zobl8rkx3.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy5600r4e1z6zobl8rkx3.webp" alt=" " width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Notebook style
&lt;/h2&gt;

&lt;p&gt;The style is used by the Jupyter Notebook.&lt;br&gt;
Set the style:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.style.use(["notebook"])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We’ll get such a format:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3boy2xz4epzr91tqj6m.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3boy2xz4epzr91tqj6m.webp" alt=" " width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Nature style
&lt;/h2&gt;

&lt;p&gt;The style is used by the Nature scientific magazine.&lt;br&gt;
Set the style in code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.style.use(["nature"])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s the result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fykzhf6o0kqfehqubi1qi.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fykzhf6o0kqfehqubi1qi.webp" alt=" " width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Grid style
&lt;/h2&gt;

&lt;p&gt;The grid style adds the grid to our graph.&lt;br&gt;
Set the style in code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.style.use(["grid"])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s why we get this graph:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc8sdwtdp6ddb3sbqlwsx.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc8sdwtdp6ddb3sbqlwsx.webp" alt=" " width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Style mixing
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Science + no-latex + grid styles
&lt;/h2&gt;

&lt;p&gt;An example of how to mix different styles, such as science and no-latex, with a grid, can be seen below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.style.use(["science", "no-latex", "grid"])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As we can see, we just changed only one row and added the grid style to another two.&lt;br&gt;
Our graph will look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6x3t1nwf2mtff9mn2we.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6x3t1nwf2mtff9mn2we.webp" alt=" " width="800" height="538"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Science + no-latex + notebook styles
&lt;/h2&gt;

&lt;p&gt;Just add the third style in code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.style.use(["science", "no-latex", "notebook"])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, we’ll see the result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqizbhs8rjaiyqrfxqdpr.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqizbhs8rjaiyqrfxqdpr.webp" alt=" " width="800" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Science + no-latex + nature styles
&lt;/h2&gt;

&lt;p&gt;Change the styles in code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.style.use(["science", "no-latex", "nature"])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqpy88ospvyh2u3vhmr9v.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqpy88ospvyh2u3vhmr9v.webp" alt=" " width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Science + no-latex + ieee styles
&lt;/h2&gt;

&lt;p&gt;Add the IEEE style to our current ones:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.style.use(["science", "no-latex", "ieee"])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the next step, we need to clearly define the font that our graph style will use. The problem is that the IEEE style uses only Times New Roman font, but the program will search for the font called Times, which isn’t the full name of the font. We’ve got an error because we don’t have a font with the same name.&lt;br&gt;
To exit from the situation, we need to clearly define that we will search for Times New Roman instead of Times.&lt;br&gt;
That’s why we define the font:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.rcParams.update(
        {
            "font.family": "serif",
            "font.serif": "Times New Roman",
            "figure.dpi": "100",
        }
    )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the code:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn1gl1o2wri18ixwbe8io.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn1gl1o2wri18ixwbe8io.webp" alt=" " width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, we learned how to change and add some specific styles for the matplotlib graphs. So, now we know why we need to use certain styles and how to use them in code. Thanks for your attention!&lt;/p&gt;

&lt;h2&gt;
  
  
  Used resources
&lt;/h2&gt;

&lt;p&gt;(n. d.). Bitcoin USD ( BTC-USD) — Price History. Digrin. &lt;a href="https://www.digrin.com/stocks/detail/BTC-USD/price" rel="noopener noreferrer"&gt;https://www.digrin.com/stocks/detail/BTC-USD/price&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>science</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
