Seaborn style plot of pandas dataframeHow to make the equivalent of a seaborn heatmap?How do i get the x axis on top but keep a line on the bottomWrong ticks in colorbar using pgfplotsLocation and size of pgf plot axis in a tikzpicture - with tikz positioning library?How to prevent rounded and duplicated tick labels in pgfplots with fixed precision?pgfplots: percentage in matrix plotCenter the axes in the coordinate originscatter plot - mark absolute size from data and custom colormapPGFplots-warning: Sorry, the colorbar is uninitialised - your axis has no color dataPlotting a 3D data-set from a .csv fileUsing PGFPlots to plot Mathematica Interpolated Function

Where to find an interactive PDF or HTML version of the tex.web documentation?

Aftermath of nuclear disaster at Three Mile Island

Heisenberg uncertainty principle in daily life

How do I stop my characters falling in love?

Examples of simultaneous independent breakthroughs

Isolated audio without a transformer

Does academia have a lazy work culture?

The Sword in the Stone

Decreasing star size

Pointwise convergence of uniformly continuous functions to zero, but not uniformly

How acidic does a mixture have to be for milk to curdle?

Why do planes need a roll motion?

Finding minimum time for vehicle to reach to its destination

What does "see" in "the Holy See" mean?

Are there any examples of technologies have been lost over time?

The best place for swimming in Arctic Ocean

Send a single HTML email from Thunderbird, overriding the default "plain text" setting

Make AES more secure by randomising the blocks in an encrypted file

Is a fighting a fallen friend with the help of a redeemed villain story too much for one book

Is there a wealth gap in Boston where the median net worth of white households is $247,500 while the median net worth for black families was $8?

Interrupt pin type on the 6502

How to tar a list of directories only if they exist

How did Mysterio have these drones?

Why is it considered Acid Rain with pH <5.6



Seaborn style plot of pandas dataframe


How to make the equivalent of a seaborn heatmap?How do i get the x axis on top but keep a line on the bottomWrong ticks in colorbar using pgfplotsLocation and size of pgf plot axis in a tikzpicture - with tikz positioning library?How to prevent rounded and duplicated tick labels in pgfplots with fixed precision?pgfplots: percentage in matrix plotCenter the axes in the coordinate originscatter plot - mark absolute size from data and custom colormapPGFplots-warning: Sorry, the colorbar is uninitialised - your axis has no color dataPlotting a 3D data-set from a .csv fileUsing PGFPlots to plot Mathematica Interpolated Function






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















There is a similar question like mine, but I am not satisfied with the answer, because the axis labels there are coordinates, while I am looking to also have the column and index labels written as text as in seaborn.



This is the output of from seaborn which I want to reproduce (never mind the colormap).



enter image description here



Here's the python code I use to generate an output for pgfplots to use.



import pandas as pd
import seaborn as sns
data = [[3, 10], [2, 15]]
df = pd.DataFrame(data, columns = ['foo', 'bar'],index = ["foo2","bar2"])
sns.heatmap(df,annot=True)

def generate_file(df):
with open("mwe.dat","w") as f:
for i in range(len(df.index)):
for j in range(len(df.columns)):
f.write(" n".format(j,i,df.values[i][j]))
f.write("n")
generate_file(df)


This create mwe.dat with the following content:



0 0 3
1 0 10

0 1 2
1 1 15


And this is my latex mwe for my current solution, lacking the text labels and the values written in the middle:



documentclass[tikz]standalone
usepackagepgfplots
begindocument

begintikzpicture
beginaxis[view=090,
colorbar,
]
addplot3[matrix plot,point meta=explicit] file mwe.dat;
endaxis
endtikzpicture

enddocument


This currently outputs this:



enter image description here



So I have two questions:



  • how to add text labels to axes, instead of coordinates?

  • how to write the value in the middle of the cell?

Since I will be using python anyway to generate the original dataframes, it is okay if I need python to actually generate the entire latex code, but I would prefer a solution, where python only generates a data file containing all info needed for the plot (I want to avoid changing things by hand).










share|improve this question
























  • Would be nice if you could add mwe.dat to the question as well, so people don't have to run your Python code. Edit: and if I do run the Python code, the LaTeX example throws an error.

    – Torbjørn T.
    6 hours ago












  • @TorbjørnT. Thanks, good idea, I updated the question.

    – fbence
    6 hours ago











  • @DJP there was something off with the generated mwe.dat.

    – fbence
    6 hours ago

















2















There is a similar question like mine, but I am not satisfied with the answer, because the axis labels there are coordinates, while I am looking to also have the column and index labels written as text as in seaborn.



This is the output of from seaborn which I want to reproduce (never mind the colormap).



enter image description here



Here's the python code I use to generate an output for pgfplots to use.



import pandas as pd
import seaborn as sns
data = [[3, 10], [2, 15]]
df = pd.DataFrame(data, columns = ['foo', 'bar'],index = ["foo2","bar2"])
sns.heatmap(df,annot=True)

def generate_file(df):
with open("mwe.dat","w") as f:
for i in range(len(df.index)):
for j in range(len(df.columns)):
f.write(" n".format(j,i,df.values[i][j]))
f.write("n")
generate_file(df)


This create mwe.dat with the following content:



0 0 3
1 0 10

0 1 2
1 1 15


And this is my latex mwe for my current solution, lacking the text labels and the values written in the middle:



documentclass[tikz]standalone
usepackagepgfplots
begindocument

begintikzpicture
beginaxis[view=090,
colorbar,
]
addplot3[matrix plot,point meta=explicit] file mwe.dat;
endaxis
endtikzpicture

enddocument


This currently outputs this:



enter image description here



So I have two questions:



  • how to add text labels to axes, instead of coordinates?

  • how to write the value in the middle of the cell?

Since I will be using python anyway to generate the original dataframes, it is okay if I need python to actually generate the entire latex code, but I would prefer a solution, where python only generates a data file containing all info needed for the plot (I want to avoid changing things by hand).










share|improve this question
























  • Would be nice if you could add mwe.dat to the question as well, so people don't have to run your Python code. Edit: and if I do run the Python code, the LaTeX example throws an error.

    – Torbjørn T.
    6 hours ago












  • @TorbjørnT. Thanks, good idea, I updated the question.

    – fbence
    6 hours ago











  • @DJP there was something off with the generated mwe.dat.

    – fbence
    6 hours ago













2












2








2


1






There is a similar question like mine, but I am not satisfied with the answer, because the axis labels there are coordinates, while I am looking to also have the column and index labels written as text as in seaborn.



This is the output of from seaborn which I want to reproduce (never mind the colormap).



enter image description here



Here's the python code I use to generate an output for pgfplots to use.



import pandas as pd
import seaborn as sns
data = [[3, 10], [2, 15]]
df = pd.DataFrame(data, columns = ['foo', 'bar'],index = ["foo2","bar2"])
sns.heatmap(df,annot=True)

def generate_file(df):
with open("mwe.dat","w") as f:
for i in range(len(df.index)):
for j in range(len(df.columns)):
f.write(" n".format(j,i,df.values[i][j]))
f.write("n")
generate_file(df)


This create mwe.dat with the following content:



0 0 3
1 0 10

0 1 2
1 1 15


And this is my latex mwe for my current solution, lacking the text labels and the values written in the middle:



documentclass[tikz]standalone
usepackagepgfplots
begindocument

begintikzpicture
beginaxis[view=090,
colorbar,
]
addplot3[matrix plot,point meta=explicit] file mwe.dat;
endaxis
endtikzpicture

enddocument


This currently outputs this:



enter image description here



So I have two questions:



  • how to add text labels to axes, instead of coordinates?

  • how to write the value in the middle of the cell?

Since I will be using python anyway to generate the original dataframes, it is okay if I need python to actually generate the entire latex code, but I would prefer a solution, where python only generates a data file containing all info needed for the plot (I want to avoid changing things by hand).










share|improve this question
















There is a similar question like mine, but I am not satisfied with the answer, because the axis labels there are coordinates, while I am looking to also have the column and index labels written as text as in seaborn.



This is the output of from seaborn which I want to reproduce (never mind the colormap).



enter image description here



Here's the python code I use to generate an output for pgfplots to use.



import pandas as pd
import seaborn as sns
data = [[3, 10], [2, 15]]
df = pd.DataFrame(data, columns = ['foo', 'bar'],index = ["foo2","bar2"])
sns.heatmap(df,annot=True)

def generate_file(df):
with open("mwe.dat","w") as f:
for i in range(len(df.index)):
for j in range(len(df.columns)):
f.write(" n".format(j,i,df.values[i][j]))
f.write("n")
generate_file(df)


This create mwe.dat with the following content:



0 0 3
1 0 10

0 1 2
1 1 15


And this is my latex mwe for my current solution, lacking the text labels and the values written in the middle:



documentclass[tikz]standalone
usepackagepgfplots
begindocument

begintikzpicture
beginaxis[view=090,
colorbar,
]
addplot3[matrix plot,point meta=explicit] file mwe.dat;
endaxis
endtikzpicture

enddocument


This currently outputs this:



enter image description here



So I have two questions:



  • how to add text labels to axes, instead of coordinates?

  • how to write the value in the middle of the cell?

Since I will be using python anyway to generate the original dataframes, it is okay if I need python to actually generate the entire latex code, but I would prefer a solution, where python only generates a data file containing all info needed for the plot (I want to avoid changing things by hand).







pgfplots






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 6 hours ago







fbence

















asked 8 hours ago









fbencefbence

7611 gold badge5 silver badges19 bronze badges




7611 gold badge5 silver badges19 bronze badges












  • Would be nice if you could add mwe.dat to the question as well, so people don't have to run your Python code. Edit: and if I do run the Python code, the LaTeX example throws an error.

    – Torbjørn T.
    6 hours ago












  • @TorbjørnT. Thanks, good idea, I updated the question.

    – fbence
    6 hours ago











  • @DJP there was something off with the generated mwe.dat.

    – fbence
    6 hours ago

















  • Would be nice if you could add mwe.dat to the question as well, so people don't have to run your Python code. Edit: and if I do run the Python code, the LaTeX example throws an error.

    – Torbjørn T.
    6 hours ago












  • @TorbjørnT. Thanks, good idea, I updated the question.

    – fbence
    6 hours ago











  • @DJP there was something off with the generated mwe.dat.

    – fbence
    6 hours ago
















Would be nice if you could add mwe.dat to the question as well, so people don't have to run your Python code. Edit: and if I do run the Python code, the LaTeX example throws an error.

– Torbjørn T.
6 hours ago






Would be nice if you could add mwe.dat to the question as well, so people don't have to run your Python code. Edit: and if I do run the Python code, the LaTeX example throws an error.

– Torbjørn T.
6 hours ago














@TorbjørnT. Thanks, good idea, I updated the question.

– fbence
6 hours ago





@TorbjørnT. Thanks, good idea, I updated the question.

– fbence
6 hours ago













@DJP there was something off with the generated mwe.dat.

– fbence
6 hours ago





@DJP there was something off with the generated mwe.dat.

– fbence
6 hours ago










2 Answers
2






active

oldest

votes


















3














If you change the Python code to also print the column names and index values:





import pandas as pd
import seaborn as sns
data = [[3, 10], [2, 15]]
df = pd.DataFrame(data, columns = ['foo', 'bar'],index = ["foo2","bar2"])
sns.heatmap(df,annot=True)

def generate_file(df):
with open("mwe.dat","w") as f:
f.write("x y z xl yln")
for i,line in enumerate(df.values):
for j,val in enumerate(line):
f.write(" n".format(j,i,val, df.columns[j], df.index[j]))
f.write("n")
generate_file(df)


So mwe.dat becomes



x y z xl yl
0 0 3 foo foo2
1 0 10 bar bar2

0 1 2 foo foo2
1 1 15 bar bar2


Then you can set the tick locations and read the ticklabels from the file like in the code below. x/yticklabels from table seems to assume that the file has a header row, hence the addition of that.



nodes near coords, nodes near coords align=center can be used to place the values in the cells.



Note the use of addplot ... table instead of addplot ... file.





documentclass[border=5mm,tikz]standalone
usepackagepgfplots
begindocument

begintikzpicture
beginaxis[
view=090,
colorbar,
xtick=data,
ytick=data,
xticklabels from table=mwe.datxl,
yticklabels from table=mwe.datyl,
yticklabel style=rotate=90
]
addplot3[matrix plot, nodes near coords, nodes near coords align=center] table mwe.dat;
endaxis
endtikzpicture

enddocument


enter image description here






share|improve this answer

























  • I removed point meta=explicit because that caused an error.

    – Torbjørn T.
    6 hours ago











  • It's working in my code. I can remove my code in a moment as you posted first.

    – DJP
    6 hours ago











  • I guess I started answer before you because when I posted, your answer was there already.

    – DJP
    6 hours ago











  • My colors and numbers were in different blocks than both of yours, so I'm assuming there is a mistake.

    – DJP
    6 hours ago











  • @TorbjørnT. So if I want to automate the creation of the xticklabel and yticklabel, the best if if I just write a latex template with the python code? No clear way to pass this info through mwe.dat?

    – fbence
    6 hours ago


















2














Here's one way



documentclass[tikz,border=20pt]standalone
usepackagepgfplots, filecontents
pgfplotssetcompat=1.13
begindocument
beginfilecontents*mwe.dat
0 0 3
1 0 10

0 1 2
1 1 15
endfilecontents*
begintikzpicture
beginaxis[view=090, colorbar,hide axis,nodes near coords = pgfmathprintnumberpgfplotspointmeta]
addplot [matrix plot*,point meta=explicit] file mwe.dat;
node[] at (axis cs: -0.010,-.65) foo;
node[] at (axis cs: 0.980,-.65) bar;
node[rotate=90] at (axis cs: -0.59,.01) bar2;
node[rotate=90] at (axis cs: -0.590,1.0) foo2;
endaxis
endtikzpicture
enddocument


The output from Gummi is:
enter image description here



With respect to your question "how to add text labels to axes, instead of coordinates?" I did hide axis in setting the axis. Then I added nodes with the labels you wanted and positioned them and rotated them where you wanted. As for "how to write the value in the middle of the cell?", I added nodes near coords = pgfmathprintnumberpgfplotspointmeta in setting up the axis. I'm wondering about the data file matching up with your picture, though, as the numbers are in the wrong row. The colors are in different rows as well.






share|improve this answer



























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "85"
    ;
    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: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2ftex.stackexchange.com%2fquestions%2f501835%2fseaborn-style-plot-of-pandas-dataframe%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    If you change the Python code to also print the column names and index values:





    import pandas as pd
    import seaborn as sns
    data = [[3, 10], [2, 15]]
    df = pd.DataFrame(data, columns = ['foo', 'bar'],index = ["foo2","bar2"])
    sns.heatmap(df,annot=True)

    def generate_file(df):
    with open("mwe.dat","w") as f:
    f.write("x y z xl yln")
    for i,line in enumerate(df.values):
    for j,val in enumerate(line):
    f.write(" n".format(j,i,val, df.columns[j], df.index[j]))
    f.write("n")
    generate_file(df)


    So mwe.dat becomes



    x y z xl yl
    0 0 3 foo foo2
    1 0 10 bar bar2

    0 1 2 foo foo2
    1 1 15 bar bar2


    Then you can set the tick locations and read the ticklabels from the file like in the code below. x/yticklabels from table seems to assume that the file has a header row, hence the addition of that.



    nodes near coords, nodes near coords align=center can be used to place the values in the cells.



    Note the use of addplot ... table instead of addplot ... file.





    documentclass[border=5mm,tikz]standalone
    usepackagepgfplots
    begindocument

    begintikzpicture
    beginaxis[
    view=090,
    colorbar,
    xtick=data,
    ytick=data,
    xticklabels from table=mwe.datxl,
    yticklabels from table=mwe.datyl,
    yticklabel style=rotate=90
    ]
    addplot3[matrix plot, nodes near coords, nodes near coords align=center] table mwe.dat;
    endaxis
    endtikzpicture

    enddocument


    enter image description here






    share|improve this answer

























    • I removed point meta=explicit because that caused an error.

      – Torbjørn T.
      6 hours ago











    • It's working in my code. I can remove my code in a moment as you posted first.

      – DJP
      6 hours ago











    • I guess I started answer before you because when I posted, your answer was there already.

      – DJP
      6 hours ago











    • My colors and numbers were in different blocks than both of yours, so I'm assuming there is a mistake.

      – DJP
      6 hours ago











    • @TorbjørnT. So if I want to automate the creation of the xticklabel and yticklabel, the best if if I just write a latex template with the python code? No clear way to pass this info through mwe.dat?

      – fbence
      6 hours ago















    3














    If you change the Python code to also print the column names and index values:





    import pandas as pd
    import seaborn as sns
    data = [[3, 10], [2, 15]]
    df = pd.DataFrame(data, columns = ['foo', 'bar'],index = ["foo2","bar2"])
    sns.heatmap(df,annot=True)

    def generate_file(df):
    with open("mwe.dat","w") as f:
    f.write("x y z xl yln")
    for i,line in enumerate(df.values):
    for j,val in enumerate(line):
    f.write(" n".format(j,i,val, df.columns[j], df.index[j]))
    f.write("n")
    generate_file(df)


    So mwe.dat becomes



    x y z xl yl
    0 0 3 foo foo2
    1 0 10 bar bar2

    0 1 2 foo foo2
    1 1 15 bar bar2


    Then you can set the tick locations and read the ticklabels from the file like in the code below. x/yticklabels from table seems to assume that the file has a header row, hence the addition of that.



    nodes near coords, nodes near coords align=center can be used to place the values in the cells.



    Note the use of addplot ... table instead of addplot ... file.





    documentclass[border=5mm,tikz]standalone
    usepackagepgfplots
    begindocument

    begintikzpicture
    beginaxis[
    view=090,
    colorbar,
    xtick=data,
    ytick=data,
    xticklabels from table=mwe.datxl,
    yticklabels from table=mwe.datyl,
    yticklabel style=rotate=90
    ]
    addplot3[matrix plot, nodes near coords, nodes near coords align=center] table mwe.dat;
    endaxis
    endtikzpicture

    enddocument


    enter image description here






    share|improve this answer

























    • I removed point meta=explicit because that caused an error.

      – Torbjørn T.
      6 hours ago











    • It's working in my code. I can remove my code in a moment as you posted first.

      – DJP
      6 hours ago











    • I guess I started answer before you because when I posted, your answer was there already.

      – DJP
      6 hours ago











    • My colors and numbers were in different blocks than both of yours, so I'm assuming there is a mistake.

      – DJP
      6 hours ago











    • @TorbjørnT. So if I want to automate the creation of the xticklabel and yticklabel, the best if if I just write a latex template with the python code? No clear way to pass this info through mwe.dat?

      – fbence
      6 hours ago













    3












    3








    3







    If you change the Python code to also print the column names and index values:





    import pandas as pd
    import seaborn as sns
    data = [[3, 10], [2, 15]]
    df = pd.DataFrame(data, columns = ['foo', 'bar'],index = ["foo2","bar2"])
    sns.heatmap(df,annot=True)

    def generate_file(df):
    with open("mwe.dat","w") as f:
    f.write("x y z xl yln")
    for i,line in enumerate(df.values):
    for j,val in enumerate(line):
    f.write(" n".format(j,i,val, df.columns[j], df.index[j]))
    f.write("n")
    generate_file(df)


    So mwe.dat becomes



    x y z xl yl
    0 0 3 foo foo2
    1 0 10 bar bar2

    0 1 2 foo foo2
    1 1 15 bar bar2


    Then you can set the tick locations and read the ticklabels from the file like in the code below. x/yticklabels from table seems to assume that the file has a header row, hence the addition of that.



    nodes near coords, nodes near coords align=center can be used to place the values in the cells.



    Note the use of addplot ... table instead of addplot ... file.





    documentclass[border=5mm,tikz]standalone
    usepackagepgfplots
    begindocument

    begintikzpicture
    beginaxis[
    view=090,
    colorbar,
    xtick=data,
    ytick=data,
    xticklabels from table=mwe.datxl,
    yticklabels from table=mwe.datyl,
    yticklabel style=rotate=90
    ]
    addplot3[matrix plot, nodes near coords, nodes near coords align=center] table mwe.dat;
    endaxis
    endtikzpicture

    enddocument


    enter image description here






    share|improve this answer















    If you change the Python code to also print the column names and index values:





    import pandas as pd
    import seaborn as sns
    data = [[3, 10], [2, 15]]
    df = pd.DataFrame(data, columns = ['foo', 'bar'],index = ["foo2","bar2"])
    sns.heatmap(df,annot=True)

    def generate_file(df):
    with open("mwe.dat","w") as f:
    f.write("x y z xl yln")
    for i,line in enumerate(df.values):
    for j,val in enumerate(line):
    f.write(" n".format(j,i,val, df.columns[j], df.index[j]))
    f.write("n")
    generate_file(df)


    So mwe.dat becomes



    x y z xl yl
    0 0 3 foo foo2
    1 0 10 bar bar2

    0 1 2 foo foo2
    1 1 15 bar bar2


    Then you can set the tick locations and read the ticklabels from the file like in the code below. x/yticklabels from table seems to assume that the file has a header row, hence the addition of that.



    nodes near coords, nodes near coords align=center can be used to place the values in the cells.



    Note the use of addplot ... table instead of addplot ... file.





    documentclass[border=5mm,tikz]standalone
    usepackagepgfplots
    begindocument

    begintikzpicture
    beginaxis[
    view=090,
    colorbar,
    xtick=data,
    ytick=data,
    xticklabels from table=mwe.datxl,
    yticklabels from table=mwe.datyl,
    yticklabel style=rotate=90
    ]
    addplot3[matrix plot, nodes near coords, nodes near coords align=center] table mwe.dat;
    endaxis
    endtikzpicture

    enddocument


    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 3 hours ago

























    answered 6 hours ago









    Torbjørn T.Torbjørn T.

    163k13 gold badges267 silver badges453 bronze badges




    163k13 gold badges267 silver badges453 bronze badges












    • I removed point meta=explicit because that caused an error.

      – Torbjørn T.
      6 hours ago











    • It's working in my code. I can remove my code in a moment as you posted first.

      – DJP
      6 hours ago











    • I guess I started answer before you because when I posted, your answer was there already.

      – DJP
      6 hours ago











    • My colors and numbers were in different blocks than both of yours, so I'm assuming there is a mistake.

      – DJP
      6 hours ago











    • @TorbjørnT. So if I want to automate the creation of the xticklabel and yticklabel, the best if if I just write a latex template with the python code? No clear way to pass this info through mwe.dat?

      – fbence
      6 hours ago

















    • I removed point meta=explicit because that caused an error.

      – Torbjørn T.
      6 hours ago











    • It's working in my code. I can remove my code in a moment as you posted first.

      – DJP
      6 hours ago











    • I guess I started answer before you because when I posted, your answer was there already.

      – DJP
      6 hours ago











    • My colors and numbers were in different blocks than both of yours, so I'm assuming there is a mistake.

      – DJP
      6 hours ago











    • @TorbjørnT. So if I want to automate the creation of the xticklabel and yticklabel, the best if if I just write a latex template with the python code? No clear way to pass this info through mwe.dat?

      – fbence
      6 hours ago
















    I removed point meta=explicit because that caused an error.

    – Torbjørn T.
    6 hours ago





    I removed point meta=explicit because that caused an error.

    – Torbjørn T.
    6 hours ago













    It's working in my code. I can remove my code in a moment as you posted first.

    – DJP
    6 hours ago





    It's working in my code. I can remove my code in a moment as you posted first.

    – DJP
    6 hours ago













    I guess I started answer before you because when I posted, your answer was there already.

    – DJP
    6 hours ago





    I guess I started answer before you because when I posted, your answer was there already.

    – DJP
    6 hours ago













    My colors and numbers were in different blocks than both of yours, so I'm assuming there is a mistake.

    – DJP
    6 hours ago





    My colors and numbers were in different blocks than both of yours, so I'm assuming there is a mistake.

    – DJP
    6 hours ago













    @TorbjørnT. So if I want to automate the creation of the xticklabel and yticklabel, the best if if I just write a latex template with the python code? No clear way to pass this info through mwe.dat?

    – fbence
    6 hours ago





    @TorbjørnT. So if I want to automate the creation of the xticklabel and yticklabel, the best if if I just write a latex template with the python code? No clear way to pass this info through mwe.dat?

    – fbence
    6 hours ago













    2














    Here's one way



    documentclass[tikz,border=20pt]standalone
    usepackagepgfplots, filecontents
    pgfplotssetcompat=1.13
    begindocument
    beginfilecontents*mwe.dat
    0 0 3
    1 0 10

    0 1 2
    1 1 15
    endfilecontents*
    begintikzpicture
    beginaxis[view=090, colorbar,hide axis,nodes near coords = pgfmathprintnumberpgfplotspointmeta]
    addplot [matrix plot*,point meta=explicit] file mwe.dat;
    node[] at (axis cs: -0.010,-.65) foo;
    node[] at (axis cs: 0.980,-.65) bar;
    node[rotate=90] at (axis cs: -0.59,.01) bar2;
    node[rotate=90] at (axis cs: -0.590,1.0) foo2;
    endaxis
    endtikzpicture
    enddocument


    The output from Gummi is:
    enter image description here



    With respect to your question "how to add text labels to axes, instead of coordinates?" I did hide axis in setting the axis. Then I added nodes with the labels you wanted and positioned them and rotated them where you wanted. As for "how to write the value in the middle of the cell?", I added nodes near coords = pgfmathprintnumberpgfplotspointmeta in setting up the axis. I'm wondering about the data file matching up with your picture, though, as the numbers are in the wrong row. The colors are in different rows as well.






    share|improve this answer





























      2














      Here's one way



      documentclass[tikz,border=20pt]standalone
      usepackagepgfplots, filecontents
      pgfplotssetcompat=1.13
      begindocument
      beginfilecontents*mwe.dat
      0 0 3
      1 0 10

      0 1 2
      1 1 15
      endfilecontents*
      begintikzpicture
      beginaxis[view=090, colorbar,hide axis,nodes near coords = pgfmathprintnumberpgfplotspointmeta]
      addplot [matrix plot*,point meta=explicit] file mwe.dat;
      node[] at (axis cs: -0.010,-.65) foo;
      node[] at (axis cs: 0.980,-.65) bar;
      node[rotate=90] at (axis cs: -0.59,.01) bar2;
      node[rotate=90] at (axis cs: -0.590,1.0) foo2;
      endaxis
      endtikzpicture
      enddocument


      The output from Gummi is:
      enter image description here



      With respect to your question "how to add text labels to axes, instead of coordinates?" I did hide axis in setting the axis. Then I added nodes with the labels you wanted and positioned them and rotated them where you wanted. As for "how to write the value in the middle of the cell?", I added nodes near coords = pgfmathprintnumberpgfplotspointmeta in setting up the axis. I'm wondering about the data file matching up with your picture, though, as the numbers are in the wrong row. The colors are in different rows as well.






      share|improve this answer



























        2












        2








        2







        Here's one way



        documentclass[tikz,border=20pt]standalone
        usepackagepgfplots, filecontents
        pgfplotssetcompat=1.13
        begindocument
        beginfilecontents*mwe.dat
        0 0 3
        1 0 10

        0 1 2
        1 1 15
        endfilecontents*
        begintikzpicture
        beginaxis[view=090, colorbar,hide axis,nodes near coords = pgfmathprintnumberpgfplotspointmeta]
        addplot [matrix plot*,point meta=explicit] file mwe.dat;
        node[] at (axis cs: -0.010,-.65) foo;
        node[] at (axis cs: 0.980,-.65) bar;
        node[rotate=90] at (axis cs: -0.59,.01) bar2;
        node[rotate=90] at (axis cs: -0.590,1.0) foo2;
        endaxis
        endtikzpicture
        enddocument


        The output from Gummi is:
        enter image description here



        With respect to your question "how to add text labels to axes, instead of coordinates?" I did hide axis in setting the axis. Then I added nodes with the labels you wanted and positioned them and rotated them where you wanted. As for "how to write the value in the middle of the cell?", I added nodes near coords = pgfmathprintnumberpgfplotspointmeta in setting up the axis. I'm wondering about the data file matching up with your picture, though, as the numbers are in the wrong row. The colors are in different rows as well.






        share|improve this answer















        Here's one way



        documentclass[tikz,border=20pt]standalone
        usepackagepgfplots, filecontents
        pgfplotssetcompat=1.13
        begindocument
        beginfilecontents*mwe.dat
        0 0 3
        1 0 10

        0 1 2
        1 1 15
        endfilecontents*
        begintikzpicture
        beginaxis[view=090, colorbar,hide axis,nodes near coords = pgfmathprintnumberpgfplotspointmeta]
        addplot [matrix plot*,point meta=explicit] file mwe.dat;
        node[] at (axis cs: -0.010,-.65) foo;
        node[] at (axis cs: 0.980,-.65) bar;
        node[rotate=90] at (axis cs: -0.59,.01) bar2;
        node[rotate=90] at (axis cs: -0.590,1.0) foo2;
        endaxis
        endtikzpicture
        enddocument


        The output from Gummi is:
        enter image description here



        With respect to your question "how to add text labels to axes, instead of coordinates?" I did hide axis in setting the axis. Then I added nodes with the labels you wanted and positioned them and rotated them where you wanted. As for "how to write the value in the middle of the cell?", I added nodes near coords = pgfmathprintnumberpgfplotspointmeta in setting up the axis. I'm wondering about the data file matching up with your picture, though, as the numbers are in the wrong row. The colors are in different rows as well.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 6 hours ago

























        answered 6 hours ago









        DJPDJP

        8,2992 gold badges18 silver badges32 bronze badges




        8,2992 gold badges18 silver badges32 bronze badges



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • 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%2ftex.stackexchange.com%2fquestions%2f501835%2fseaborn-style-plot-of-pandas-dataframe%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

            Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

            Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

            François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480