In seaborn, how to increase the graph and save as image?












0














In python3 and pandas I have this dataframe:



gastos_anuais.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 5 entries, 0 to 4
Data columns (total 2 columns):
ano 5 non-null int64
valor_pago 5 non-null float64
dtypes: float64(1), int64(1)
memory usage: 280.0 bytes

gastos_anuais.reset_index()
index ano valor_pago
0 0 2014 13,082,008,854.37
1 3 2017 9,412,069,205.73
2 2 2016 7,617,420,559.22
3 1 2015 7,470,391,492.24
4 4 2018 7,099,199,179.11


I did a pointplot chart:



import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline

sns.pointplot(x='ano', y='valor_pago', data=gastos_anuais)

plt.xticks(rotation=65)
plt.grid(True, linestyle="--")
plt.title("Gastos Destinados pelo Governo Federal (2014-2018)n")
plt.xlabel("Anos")
plt.ylabel("Em bilhões de R$")
plt.show()


It worked. But I would like to:




  • Increase the size of the chart that appears on the screen


  • Can save image format, .jpeg file for example


  • And I do not understand why below the title of the graph appears '1e10'



Please, does anyone know how I can do it?










share|improve this question






















  • Possible duplicate of How do you change the size of figures drawn with matplotlib?
    – Diziet Asahi
    Nov 22 at 20:46
















0














In python3 and pandas I have this dataframe:



gastos_anuais.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 5 entries, 0 to 4
Data columns (total 2 columns):
ano 5 non-null int64
valor_pago 5 non-null float64
dtypes: float64(1), int64(1)
memory usage: 280.0 bytes

gastos_anuais.reset_index()
index ano valor_pago
0 0 2014 13,082,008,854.37
1 3 2017 9,412,069,205.73
2 2 2016 7,617,420,559.22
3 1 2015 7,470,391,492.24
4 4 2018 7,099,199,179.11


I did a pointplot chart:



import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline

sns.pointplot(x='ano', y='valor_pago', data=gastos_anuais)

plt.xticks(rotation=65)
plt.grid(True, linestyle="--")
plt.title("Gastos Destinados pelo Governo Federal (2014-2018)n")
plt.xlabel("Anos")
plt.ylabel("Em bilhões de R$")
plt.show()


It worked. But I would like to:




  • Increase the size of the chart that appears on the screen


  • Can save image format, .jpeg file for example


  • And I do not understand why below the title of the graph appears '1e10'



Please, does anyone know how I can do it?










share|improve this question






















  • Possible duplicate of How do you change the size of figures drawn with matplotlib?
    – Diziet Asahi
    Nov 22 at 20:46














0












0








0







In python3 and pandas I have this dataframe:



gastos_anuais.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 5 entries, 0 to 4
Data columns (total 2 columns):
ano 5 non-null int64
valor_pago 5 non-null float64
dtypes: float64(1), int64(1)
memory usage: 280.0 bytes

gastos_anuais.reset_index()
index ano valor_pago
0 0 2014 13,082,008,854.37
1 3 2017 9,412,069,205.73
2 2 2016 7,617,420,559.22
3 1 2015 7,470,391,492.24
4 4 2018 7,099,199,179.11


I did a pointplot chart:



import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline

sns.pointplot(x='ano', y='valor_pago', data=gastos_anuais)

plt.xticks(rotation=65)
plt.grid(True, linestyle="--")
plt.title("Gastos Destinados pelo Governo Federal (2014-2018)n")
plt.xlabel("Anos")
plt.ylabel("Em bilhões de R$")
plt.show()


It worked. But I would like to:




  • Increase the size of the chart that appears on the screen


  • Can save image format, .jpeg file for example


  • And I do not understand why below the title of the graph appears '1e10'



Please, does anyone know how I can do it?










share|improve this question













In python3 and pandas I have this dataframe:



gastos_anuais.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 5 entries, 0 to 4
Data columns (total 2 columns):
ano 5 non-null int64
valor_pago 5 non-null float64
dtypes: float64(1), int64(1)
memory usage: 280.0 bytes

gastos_anuais.reset_index()
index ano valor_pago
0 0 2014 13,082,008,854.37
1 3 2017 9,412,069,205.73
2 2 2016 7,617,420,559.22
3 1 2015 7,470,391,492.24
4 4 2018 7,099,199,179.11


I did a pointplot chart:



import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline

sns.pointplot(x='ano', y='valor_pago', data=gastos_anuais)

plt.xticks(rotation=65)
plt.grid(True, linestyle="--")
plt.title("Gastos Destinados pelo Governo Federal (2014-2018)n")
plt.xlabel("Anos")
plt.ylabel("Em bilhões de R$")
plt.show()


It worked. But I would like to:




  • Increase the size of the chart that appears on the screen


  • Can save image format, .jpeg file for example


  • And I do not understand why below the title of the graph appears '1e10'



Please, does anyone know how I can do it?







python pandas seaborn






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 at 20:28









Reinaldo Chaves

319212




319212












  • Possible duplicate of How do you change the size of figures drawn with matplotlib?
    – Diziet Asahi
    Nov 22 at 20:46


















  • Possible duplicate of How do you change the size of figures drawn with matplotlib?
    – Diziet Asahi
    Nov 22 at 20:46
















Possible duplicate of How do you change the size of figures drawn with matplotlib?
– Diziet Asahi
Nov 22 at 20:46




Possible duplicate of How do you change the size of figures drawn with matplotlib?
– Diziet Asahi
Nov 22 at 20:46












1 Answer
1






active

oldest

votes


















1














Increase the size of the chart that appears on the screen



Add sns.set(rc={'figure.figsize':(w, h)}) before plotting. For example:



sns.set(rc={'figure.figsize':(20, 5)})


Save as jpg



Keep a reference to the plot, get the figure and save it:



p = sns.pointplot(x='ano', y='valor_pago', data=gastos_anuais)

plt.xticks(rotation=65)
#...
# All your editions with `plt`
#...

fig = p.get_figure()
fig.savefig("gastos_anuais.jpg")


What is the 1e10 in the corner?



It is the scale. This means that the values shown in the y axis should be multiplied by 10^10 to recover the actual values of the data.



If you want to remove it, you can use:



plt.ticklabel_format(style='plain', axis='y')


But you will need to do something with the values since they distort the image.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437656%2fin-seaborn-how-to-increase-the-graph-and-save-as-image%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Increase the size of the chart that appears on the screen



    Add sns.set(rc={'figure.figsize':(w, h)}) before plotting. For example:



    sns.set(rc={'figure.figsize':(20, 5)})


    Save as jpg



    Keep a reference to the plot, get the figure and save it:



    p = sns.pointplot(x='ano', y='valor_pago', data=gastos_anuais)

    plt.xticks(rotation=65)
    #...
    # All your editions with `plt`
    #...

    fig = p.get_figure()
    fig.savefig("gastos_anuais.jpg")


    What is the 1e10 in the corner?



    It is the scale. This means that the values shown in the y axis should be multiplied by 10^10 to recover the actual values of the data.



    If you want to remove it, you can use:



    plt.ticklabel_format(style='plain', axis='y')


    But you will need to do something with the values since they distort the image.






    share|improve this answer


























      1














      Increase the size of the chart that appears on the screen



      Add sns.set(rc={'figure.figsize':(w, h)}) before plotting. For example:



      sns.set(rc={'figure.figsize':(20, 5)})


      Save as jpg



      Keep a reference to the plot, get the figure and save it:



      p = sns.pointplot(x='ano', y='valor_pago', data=gastos_anuais)

      plt.xticks(rotation=65)
      #...
      # All your editions with `plt`
      #...

      fig = p.get_figure()
      fig.savefig("gastos_anuais.jpg")


      What is the 1e10 in the corner?



      It is the scale. This means that the values shown in the y axis should be multiplied by 10^10 to recover the actual values of the data.



      If you want to remove it, you can use:



      plt.ticklabel_format(style='plain', axis='y')


      But you will need to do something with the values since they distort the image.






      share|improve this answer
























        1












        1








        1






        Increase the size of the chart that appears on the screen



        Add sns.set(rc={'figure.figsize':(w, h)}) before plotting. For example:



        sns.set(rc={'figure.figsize':(20, 5)})


        Save as jpg



        Keep a reference to the plot, get the figure and save it:



        p = sns.pointplot(x='ano', y='valor_pago', data=gastos_anuais)

        plt.xticks(rotation=65)
        #...
        # All your editions with `plt`
        #...

        fig = p.get_figure()
        fig.savefig("gastos_anuais.jpg")


        What is the 1e10 in the corner?



        It is the scale. This means that the values shown in the y axis should be multiplied by 10^10 to recover the actual values of the data.



        If you want to remove it, you can use:



        plt.ticklabel_format(style='plain', axis='y')


        But you will need to do something with the values since they distort the image.






        share|improve this answer












        Increase the size of the chart that appears on the screen



        Add sns.set(rc={'figure.figsize':(w, h)}) before plotting. For example:



        sns.set(rc={'figure.figsize':(20, 5)})


        Save as jpg



        Keep a reference to the plot, get the figure and save it:



        p = sns.pointplot(x='ano', y='valor_pago', data=gastos_anuais)

        plt.xticks(rotation=65)
        #...
        # All your editions with `plt`
        #...

        fig = p.get_figure()
        fig.savefig("gastos_anuais.jpg")


        What is the 1e10 in the corner?



        It is the scale. This means that the values shown in the y axis should be multiplied by 10^10 to recover the actual values of the data.



        If you want to remove it, you can use:



        plt.ticklabel_format(style='plain', axis='y')


        But you will need to do something with the values since they distort the image.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 22 at 20:46









        Julian Peller

        849511




        849511






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437656%2fin-seaborn-how-to-increase-the-graph-and-save-as-image%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

            Calculate evaluation metrics using cross_val_predict sklearn

            Insert data from modal to MySQL (multiple modal on website)