|
| 1 | +# PGFPlot |
| 2 | +using PGFPlotsX |
| 3 | +using LaTeXStrings |
| 4 | + |
| 5 | +mj_plin_plot = @pgf PlotInc({thick, "color=orange", "mark options={orange}"}, Table(speed_mj, plin_mj)) |
| 6 | +dj_plin_plot = @pgf PlotInc({thick, "color=cyan", "mark options={cyan}"}, Table(speed_dj, plin_dj)) |
| 7 | +mj_pang_plot = @pgf PlotInc({thick, "color=orange", "mark options={orange}"}, Table(speed_mj, pang_mj)) |
| 8 | +dj_pang_plot = @pgf PlotInc({thick, "color=cyan", "mark options={cyan}"}, Table(speed_dj, pang_dj)) |
| 9 | +mj_legend = LegendEntry(raw"MuJoCo") |
| 10 | +dj_legend = LegendEntry(raw"Dojo") |
| 11 | + |
| 12 | +axs1 = @pgf LogLogAxis({ |
| 13 | + ymin=1e-15, |
| 14 | + ymax=1e1, |
| 15 | + title="linear momentum", |
| 16 | + xlabel=raw"$\times$ faster than real time", |
| 17 | + ylabel="N.s", |
| 18 | + }, |
| 19 | + dj_plin_plot, dj_legend, mj_plin_plot, mj_legend, |
| 20 | + ) |
| 21 | + |
| 22 | +axs2 = @pgf LogLogAxis({ |
| 23 | + ymin=1e-15, |
| 24 | + ymax=1e1, |
| 25 | + title="angular momentum", |
| 26 | + xshift=-20.0, |
| 27 | + # ticks="none", |
| 28 | + yticklabels={}, |
| 29 | + xlabel=raw"$\times$ faster than real time", |
| 30 | + # ylabel="(N.s)", |
| 31 | + }, |
| 32 | + dj_pang_plot, dj_legend, mj_pang_plot, mj_legend, |
| 33 | + ) |
| 34 | + |
| 35 | +gp = @pgf PGFPlotsX.GroupPlot( |
| 36 | + {group_style = {group_size="2 by 1"}, |
| 37 | + legend_style = {nodes="{scale=0.70, transform shape}", anchor="east", at="{(0.95,0.35)}"}, |
| 38 | + y_label_style={at="{(axis description cs:-0.00,.5)}", anchor="north"}, |
| 39 | + # height = "6cm", |
| 40 | + # width = "6cm", |
| 41 | + # no_markers, |
| 42 | + # xlabel=raw"$\times$ faster than real time", |
| 43 | + # legend_pos="north west", |
| 44 | + }, |
| 45 | + axs1, axs2) |
| 46 | + |
| 47 | +filename = joinpath(@__DIR__, "figures/astronaut_momentum.tikz") |
| 48 | +pgfsave(filename, gp; include_preamble = true, dpi = 150) |
| 49 | + |
| 50 | + |
| 51 | +# PGFPlot |
| 52 | +using PGFPlotsX |
| 53 | +using LaTeXStrings |
| 54 | + |
| 55 | +mj_ener_plot1 = @pgf PlotInc({very_thick, "color=orange", "mark options={orange}"}, |
| 56 | + Table(range(0,stop=100,length=length(ener_traj_mj[1])), |
| 57 | + ener_traj_mj[1])) |
| 58 | +mj_ener_plot2 = @pgf PlotInc({very_thick, "color=orange", "mark options={orange}"}, |
| 59 | + Table(range(0,stop=100,length=length(ener_traj_mj[2])), |
| 60 | + ener_traj_mj[2])) |
| 61 | +mj_ener_plot3 = @pgf PlotInc({very_thick, "color=orange", "mark options={orange}"}, |
| 62 | + Table(range(0,stop=100,length=length(ener_traj_mj[3])), |
| 63 | + ener_traj_mj[3])) |
| 64 | + |
| 65 | +dj_ener_plot1 = @pgf PlotInc({very_thick, "color=cyan", "mark options={orange}"}, |
| 66 | + Table(range(0,stop=100,length=length(ener_traj_dj[1])), |
| 67 | + ener_traj_dj[1])) |
| 68 | +dj_ener_plot2 = @pgf PlotInc({very_thick, "color=cyan", "mark options={orange}"}, |
| 69 | + Table(range(0,stop=100,length=length(ener_traj_dj[2])), |
| 70 | + ener_traj_dj[2])) |
| 71 | +dj_ener_plot3 = @pgf PlotInc({very_thick, "color=cyan", "mark options={orange}"}, |
| 72 | + Table(range(0,stop=100,length=length(ener_traj_dj[3])), |
| 73 | + ener_traj_dj[3])) |
| 74 | + |
| 75 | +mj_legend = LegendEntry(raw"MuJoCo") |
| 76 | +dj_legend = LegendEntry(raw"Dojo") |
| 77 | + |
| 78 | + |
| 79 | +axs1 = @pgf Axis({ |
| 80 | + title=raw"simulation rate $10$ Hz", |
| 81 | + ylabel="energy J", |
| 82 | + xticklabels={}, |
| 83 | + }, |
| 84 | + dj_ener_plot1, dj_legend, mj_ener_plot1, mj_legend, |
| 85 | + ) |
| 86 | + |
| 87 | +axs2 = @pgf Axis({ |
| 88 | + title=raw"simulation rate $100$ Hz", |
| 89 | + ylabel="energy J", |
| 90 | + yshift=13.0, |
| 91 | + xticklabels={}, |
| 92 | + }, |
| 93 | + dj_ener_plot2, dj_legend, mj_ener_plot2, mj_legend, |
| 94 | + ) |
| 95 | + |
| 96 | +axs3 = @pgf Axis({ |
| 97 | + title=raw"simulation rate $1000$ Hz", |
| 98 | + xlabel="time s", |
| 99 | + ylabel="energy J", |
| 100 | + yshift=13.0, |
| 101 | + }, |
| 102 | + dj_ener_plot3, dj_legend, mj_ener_plot3, mj_legend, |
| 103 | + ) |
| 104 | + |
| 105 | +gp = @pgf PGFPlotsX.GroupPlot( |
| 106 | + {group_style = {group_size="1 by 3"}, |
| 107 | + legend_style = {nodes="{scale=0.70, transform shape}"}, |
| 108 | + title_style={at="{(axis description cs:+0.5,0.95)}", anchor="south"}, |
| 109 | + y_label_style={at="{(axis description cs:+0.05,0.5)}", anchor="north"}, |
| 110 | + x_label_style={at="{(axis description cs:+0.5,0.15)}", anchor="north"}, |
| 111 | + xmin=0, |
| 112 | + xmax=100, |
| 113 | + height = "3.5cm", |
| 114 | + width = "7.5cm", |
| 115 | + no_markers, |
| 116 | + # xlabel=raw"$\times$ faster than real time", |
| 117 | + legend_pos="north west", |
| 118 | + }, |
| 119 | + axs1, axs2, axs3) |
| 120 | + |
| 121 | +filename = joinpath(@__DIR__, "figures/astronaut_energy.tikz") |
| 122 | +pgfsave(filename, gp; include_preamble = true, dpi = 150) |
0 commit comments