1
$\begingroup$

I have a plot like this:

Table[Plot[a*x^2/4, {x, 0, 5}, PlotLabel -> "a="  a], {a, 1, 5, 1}]

I want to label the plots as a=1, a=2, ..., but Mathematica labels them as a=, 2a=, ....

How can I solve this problem?

I also have another problem:

DiscretePlot3D[2 x + y, {x, {1, 4, .2}}, {y, {2, 6, .2}}, 
   Filling -> None, PlotMarkers -> {"Sphere", .01}]

Why I can not use plot markers such as *, \[FilledSquare], ... in this plot?

$\endgroup$
3
  • $\begingroup$ As to the "why" part of the question -- it is interesting that PlotMarkers isn't even mentioned in the More Information section of DiscretePlot3D nor is 3D Plot usage described in the PlotMarkers documentation. The usage DiscretePlot3D example demonstrates "Sphere" and "Point". Clearly inadequately documented. $\endgroup$ Nov 20, 2012 at 20:08
  • 1
    $\begingroup$ Is this your another account mathematica.stackexchange.com/users/1894/soodeh ? To benefit from this site it would be advantageous to register your account. $\endgroup$
    – Artes
    Nov 21, 2012 at 0:53
  • $\begingroup$ As Artes says, please consider registering your account . You'll be able to participate better in the community and also be able to login from anywhere and carry forward your points. If the above account is indeed yours, please register your current account and add the login credentials you used for the other one to confirm ownership and flag for moderator attention. $\endgroup$
    – rm -rf
    Nov 21, 2012 at 1:00

2 Answers 2

1
$\begingroup$

The PlotLabel needs to be a string, so for instance:

 Table[Plot[a*x^2/4, {x, 0, 5}, PlotLabel -> "a=" ~~ ToString[a]], {a, 1, 5, 1}]
$\endgroup$
0
1
$\begingroup$
  1. Use StringForm[]:

    Table[Plot[a*x^2/4, {x, 0, 5}, PlotLabel -> StringForm["a=`1`", a]], {a, 1, 5, 1}]
    
  2. You could make a substitution into the plot graphics object to solve the problem:

    DiscretePlot3D[2 x + y, {x, {1, 4, .2}}, {y, {2, 6, .2}}, 
                   Filling -> None, PlotMarkers -> "Point"] /. 
    Point[pts : {__?VectorQ}] :> (Text["\[FilledSquare]", #, {0, -1}] & /@ pts)
    

    3D discrete plot with squares

$\endgroup$
2
  • $\begingroup$ Thanks a lot for your helpful answer. $\endgroup$
    – soodeh
    Nov 20, 2012 at 7:33
  • $\begingroup$ @J.M. Your trick for DiscretePlot3D is sneaky clever. $\endgroup$
    – m_goldberg
    Nov 20, 2012 at 15:54

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.