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

Why isn't there a serious attempt at creating a third mass-appeal party in the US?

Seaborn style plot of pandas dataframe

When does Haskell complain about incorrect typing in functions?

Is this photo showing a woman standing in the nude before teenagers real?

What do I do with a party that is much stronger than their level?

Why do all my history books divide Chinese history after the Han dynasty?

Am I allowed to use personal conversation as a source?

Finding minimum time for vehicle to reach to its destination

How to avoid theft of intellectual property when trying to obtain a Ph.D?

Why didn't Britain or any other European power colonise Abyssinia/Ethiopia before 1936?

What is the most efficient way to write 'for' loops in Matlab?

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

Is it possible to pass "draft" option to documentclass with arara?

Is it legal to use cash pulled from a credit card to pay the monthly payment on that credit card?

What is this spacecraft tethered to another spacecraft in LEO (vintage)

Checking if an integer is a member of an integer list

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

What is the difference between 1/3, 1/2, and full casters?

How to store my pliers and wire cutters on my desk?

Character is called by their first initial. How do I write it?

Are the named pipe created by `mknod` and the FIFO created by `mkfifo` equivalent?

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

The Sword in the Stone

Trapped in an ocean Temple in Minecraft?



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.
    7 hours ago












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

    – fbence
    7 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.
    7 hours ago












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

    – fbence
    7 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 9 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.
    7 hours ago












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

    – fbence
    7 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.
    7 hours ago












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

    – fbence
    7 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.
7 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.
7 hours ago














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

– fbence
7 hours ago





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

– fbence
7 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











  • @TorbjørnT. ok, thanks, I'll wait until you conclude this to accept the answer, to have it all rounded up, but this is already pretty cool, thanks

    – fbence
    4 hours ago











  • @fbence I think x/yticklabels from table assumes the presence of a header row, so the first row was basically skipped, and the second and third row was used. That explains why the order is reversed, as the file had foo, bar, foo, bar.

    – Torbjørn T.
    4 hours ago











  • @TorbjørnT. perfect, thanks!

    – fbence
    2 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











    • @TorbjørnT. ok, thanks, I'll wait until you conclude this to accept the answer, to have it all rounded up, but this is already pretty cool, thanks

      – fbence
      4 hours ago











    • @fbence I think x/yticklabels from table assumes the presence of a header row, so the first row was basically skipped, and the second and third row was used. That explains why the order is reversed, as the file had foo, bar, foo, bar.

      – Torbjørn T.
      4 hours ago











    • @TorbjørnT. perfect, thanks!

      – fbence
      2 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











    • @TorbjørnT. ok, thanks, I'll wait until you conclude this to accept the answer, to have it all rounded up, but this is already pretty cool, thanks

      – fbence
      4 hours ago











    • @fbence I think x/yticklabels from table assumes the presence of a header row, so the first row was basically skipped, and the second and third row was used. That explains why the order is reversed, as the file had foo, bar, foo, bar.

      – Torbjørn T.
      4 hours ago











    • @TorbjørnT. perfect, thanks!

      – fbence
      2 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 4 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











    • @TorbjørnT. ok, thanks, I'll wait until you conclude this to accept the answer, to have it all rounded up, but this is already pretty cool, thanks

      – fbence
      4 hours ago











    • @fbence I think x/yticklabels from table assumes the presence of a header row, so the first row was basically skipped, and the second and third row was used. That explains why the order is reversed, as the file had foo, bar, foo, bar.

      – Torbjørn T.
      4 hours ago











    • @TorbjørnT. perfect, thanks!

      – fbence
      2 hours ago

















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

      – Torbjørn T.
      6 hours ago











    • @TorbjørnT. ok, thanks, I'll wait until you conclude this to accept the answer, to have it all rounded up, but this is already pretty cool, thanks

      – fbence
      4 hours ago











    • @fbence I think x/yticklabels from table assumes the presence of a header row, so the first row was basically skipped, and the second and third row was used. That explains why the order is reversed, as the file had foo, bar, foo, bar.

      – Torbjørn T.
      4 hours ago











    • @TorbjørnT. perfect, thanks!

      – fbence
      2 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













    @TorbjørnT. ok, thanks, I'll wait until you conclude this to accept the answer, to have it all rounded up, but this is already pretty cool, thanks

    – fbence
    4 hours ago





    @TorbjørnT. ok, thanks, I'll wait until you conclude this to accept the answer, to have it all rounded up, but this is already pretty cool, thanks

    – fbence
    4 hours ago













    @fbence I think x/yticklabels from table assumes the presence of a header row, so the first row was basically skipped, and the second and third row was used. That explains why the order is reversed, as the file had foo, bar, foo, bar.

    – Torbjørn T.
    4 hours ago





    @fbence I think x/yticklabels from table assumes the presence of a header row, so the first row was basically skipped, and the second and third row was used. That explains why the order is reversed, as the file had foo, bar, foo, bar.

    – Torbjørn T.
    4 hours ago













    @TorbjørnT. perfect, thanks!

    – fbence
    2 hours ago





    @TorbjørnT. perfect, thanks!

    – fbence
    2 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 7 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

            Sahara Skak | Bilen | Luke uk diar | NawigatsjuunCommonskategorii: SaharaWikivoyage raisfeerer: Sahara26° N, 13° O

            The fall designs the understood secretary. Looking glass Science Shock Discovery Hot Everybody Loves Raymond Smile 곳 서비스 성실하다 Defas Kaloolon Definition: To combine or impregnate with sulphur or any of its compounds as to sulphurize caoutchouc in vulcanizing Flame colored Reason Useful Thin Help 갖다 유명하다 낙엽 장례식 Country Iron Definition: A fencer a gladiator one who exhibits his skill in the use of the sword Definition: The American black throated bunting Spiza Americana Nostalgic Needy Method to my madness 시키다 평가되다 전부 소설가 우아하다 Argument Tin Feeling Representative Gym Music Gaur Chicken 일쑤 코치 편 학생증 The harbor values the sugar. Vasagle Yammoe Enstatite Definition: Capable of being limited Road Neighborly Five Refer Built Kangaroo 비비다 Degree Release Bargain Horse 하루 형님 유교 석 동부 괴롭히다 경제력

            19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу