Advertisement
Guest User

Untitled

a guest
Jan 16th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Julia 1.38 KB | None | 0 0
  1. # savefig("myplot.png") # Saves the CURRENT_PLOT as a .png
  2. # savefig(p,"myplot.pdf") # Saves the plot from p as a .pdf vector graphic
  3. using Plots
  4. using Random
  5. using ORCA
  6. using Plots.PlotMeasures
  7. plotly()
  8.  
  9. function pltsv()
  10.     colz = distinguishable_colors(41)
  11.     colz = colz[2:end]
  12.     my = maximum(y)
  13.     p1 = plot(
  14.     leg=false,
  15.     x,
  16.     y,
  17.     title=ttl,
  18.     # label=["ok","noop"],
  19.     xlabel=xlb,
  20.     ylabel=ylb,
  21.     # labels = ["Apples" "Oranges" "Hats" "Shoes"],
  22.     lw=3,
  23.     xtickfont=xf,
  24.     titlefont=10,
  25.     seriestype=:bar,
  26.     # ann=["Apples","Oranges","Hats","Shoes"],
  27.     color=shuffle(colz),
  28.     yticks=0:round(Int,my/11):my,
  29.     ylim=(0,my*1.15),
  30.     # bar_position = :dodge,
  31.     # scatter,bar,pie,curves,hline,line,scatterpath,sticks
  32.     fmt = :png,
  33.     size=(1400,900),
  34.     xrotation=-5,
  35.     # xmirror=true
  36.     # bottom_margin = 200px,
  37.     )
  38.  
  39.     scatter!(p1, x, (x -> x+my/20).(y),
  40.     txts = map(i->text(y[i], font(round(Int, 15+15*y[i]/my))), 1:length(x)),
  41.     ms=0,
  42.     markeralpha=0,
  43.     leg=false,
  44.  
  45.     # formatter=x->"",
  46.     )
  47.  
  48.     Plots.savefig(p1,"$ttl.png")
  49. end
  50.  
  51.  
  52. x = split("
  53. ### x-values go here
  54. ",'\n')
  55. x=x[2:end-1]
  56. y = (x -> parse(Int,x)).(split("
  57. ### y-values go here ###
  58. "))
  59. ttl="### title goes here ###"
  60. xlb="### x-label goes here ###"
  61. ylb="### y-label goes here ###"
  62. xf=13
  63. pltsv()
  64. # run(`gwenview $ttl.png`)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement