1
$\begingroup$

I am trying to plot a graph.

Subscript[R, 0] = 1.2; 
Subscript[A, Pb] = 208 ; 
Subscript[A, Ca] = 40; 
Subscript[A, O] = 16; 
Subscript[ρ, 0] = 0.138;
R[A_] := Subscript[R, 0]*(A^(1/3))
ρ[r_, R_, a_] := Subscript[ρ, 0]/(1 + Exp[(r - R)/a])

I cannot save the following plot with its legend.

a = 0.5;
Plot[{
  ρ[r, R[Subscript[A, Pb]], a], 
  ρ[r, R[Subscript[A, Ca]], a], 
  ρ[r, R[Subscript[A, O]], a]}, 
  {r, 0, 10}, 
  Frame -> True, 
  FrameLabel -> {"r (fm)", "ρ(r) nucleons/fm\.b3"}, 
  PlotLegends -> Placed[{"Pb", "Ca", "O"}, Right]]

I cannot select both the plot and legends to save them. How can I deal with this?

$\endgroup$
4
  • 2
    $\begingroup$ To get a contextual menu allowing you to save the entire contents of a cell, right-click the cell bracket on the right of the output. Then choose Save Selection As... In your case, this will save the graphic and legend together. $\endgroup$
    – Jens
    Commented May 29, 2014 at 5:00
  • $\begingroup$ It works, thank you! $\endgroup$
    – Thiago
    Commented May 29, 2014 at 5:12
  • $\begingroup$ @m_goldberg How did you typed the greek letter rho in? $\endgroup$
    – Thiago
    Commented May 29, 2014 at 6:22
  • $\begingroup$ I used halirutan's plug-in $\endgroup$
    – m_goldberg
    Commented May 29, 2014 at 6:49

1 Answer 1

2
$\begingroup$

Name your plot (let us say p) and the export it.

a = 0.5;
p=Plot[{\[Rho][r, R[Subscript[A, Pb]], a], \[Rho][r, 
R[Subscript[A, Ca]], a], \[Rho][r, R[Subscript[A, O]], a]}, {r, 0, 
10}, Frame -> True, 
FrameLabel -> {"r (fm)", "\[Rho](r) nucleons/fm\.b3"}, 
PlotLegends -> Placed[{"Pb", "Ca", "O"}, Right]]

and then export it using export command

Export["plot.jpg", p]

you will find the picture in the default folder which is normally Documents.

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.