Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update load_plot_pkg.jl to new Julia plotting functions #245

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions load_plot_pkg.jl
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
using PlotlyJS

# Set default values for all plots
nlaStyle = let
function set_plotly_template()
axis = attr(showgrid=true, gridcolor="#E5E5E5",
linewidth=1.0,
titlefont_color="#555555", titlefont_size=18,
linecolor="black", mirror=true, zeroline=false,
title_font_color="#555555", title_font_size=14,
linecolor="black", showline=true, mirror=true, zeroline=false,
ticks="inside")
layout = Layout(font_size=16, xaxis=axis, yaxis=axis,
layout=Layout(font_size=16, xaxis=axis, yaxis=axis,
titlefont_size=18, width=500, height=300)

colors = Cycler([
layout[:colorway]=[
"#E24A33", "#348ABD", "#988ED5", "#777777",
"#FBC15E", "#8EBA42", "#FFB5B8"
])
gta = attr(
marker_line_width=0.5, marker_line_color="#348ABD",
marker_color=colors, marker_size=10
)
Style(layout=layout, global_trace=gta)
"#FBC15E", "#8EBA42", "#FFB5B8"]

t = Template(layout=layout)
t.data[:scatter] = [attr(marker_line_width=0.5,
marker_line_color="#348ABD",
marker_size=10)]
return t
end

use_style!(nlaStyle)
fig_template = set_plotly_template()

# CHANGE: add the template under the "personal" key
templates.personal = fig_template

# CHANGE: set the default template to the "personal" template -- must match key from previous step
templates.default = "personal"

function plotToPDF(p,fileName)
savefig(p,"$fileName.html")
cmd = `/usr/libexec/cups/filter/xhtmltopdf 0 0 0 0 0 $fileName.html`
run(pipeline(cmd, stdout="$fileName.pdf"))
cmd = `pdfcrop $fileName.pdf`
run(cmd)
end
end