2017-01-16 2 views
0

Ich benutze Seaborn zum Plotten in Julia. Jedoch kann ich nicht herausfinden, wie man bestimmte Eigenschaften für set_style analysiert, z. die Linie in Python wäreSeaborn-Einstellung in Julia über PyCall

sns.set_style('darkgrid', {'axes.linewidth': 2, 'axes.edgecolor':'black'}) 

ein minimales Beispiel zu geben:

using PyPlot 
using PyCall 
@pyimport seaborn as sns 


test_plot() 
function test_plot() 
    clf() 
    #- - - 
    sns.set_style("ticks",???) 
    # - - - 
    tmp_plt=figure("plot1",figsize=(4.5, 3.5)) 
    x=collect(0:0.5:3) 
    plot(x,0.4.*x) 
    plot(x,x.^0.5) 
end 

Wer weiß, wie zu ersetzen '???' in Julia, so dass es mit dem Python-Eingang {'axes.linewidth': 2, 'axes.edgecolor':'black'} entspricht?

Vielen Dank :)

EDIT: ich eine Abhilfe mit rc für zukünftige Referenzen gefunden:

using PyPlot 
using PyCall 
@pyimport seaborn as sns 

close() 
test_plot() 
function test_plot() 
    sns.set_context("notebook", font_scale=1.4) 
    sns.set_style("ticks") 
    rc("font",family ="Computer Modern Roman") 
    rc("lines",linewidth = 2.5) 
    rc("axes",linewidth = 2,edgecolor=".55") 
    rc("axes",grid=true) 
    rc("grid",linestyle="-",color="1.0") 
    rc("legend",frameon=true,edgecolor="none",facecolor="0.85") 
    rc("axes",facecolor="0.96") 
    rc("axes",titlesize="large") 
    tmp_plt=figure("plot1",figsize=(8, 6)) 
    ax=gca() 
    x=collect(0:0.5:3) 
    plot(x,0.4.*x) 
    plot(x,x.^0.5) 
    tmp=legend(["Tmp 1", "Tmp 2"],loc=2,bbox_to_anchor=[0.0015,0.997],borderaxespad=0) 
    xlabel("basic x",labelpad =5.0) 
    ylabel("basic y",labelpad =5.0) 
    title("\$ \\sum x^2\$",y=1.08) 
    tight_layout() 
    savefig("fig2.pdf") 
end 
+0

Warum sind Sie am Seaburn beteiligt? (und auch warum PyPlot verwenden, wenn Sie Plots.jl mit dem PyPlot-Backend verwenden konnten) –

+0

@LyndonWhite vielleicht hat die OP gerade mit Julia angefangen und vertraut auf ein vertrautes Paket. Seaborn ist aus Matplotlib aufgebaut und bietet eine praktische und leistungsfähige Schnittstelle für das statistische Plotten. –

Antwort

0

Ich habe keine Ahnung über Seaborn, aber die Julia entspricht dem Python

{'axes.linewidth': 2, 'axes.edgecolor':'black'} 

ist einfach

Dict("axes.linewidth" => 2, "axes.edgecolor" => "black")