Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
2  
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. –  Jens May 29 at 5:00
    
It works, thank you! –  Ali May 29 at 5:12
    
@m_goldberg How did you typed the greek letter rho in? –  Ali May 29 at 6:22
    
I used halirutan's plug-in –  m_goldberg May 29 at 6:49
add comment

1 Answer 1

up vote 1 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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