Group Abstract Group Abstract

Message Boards Message Boards

0
|
3K Views
|
14 Replies
|
5 Total Likes
View groups...
Share
Share this post:

A function of two variables as y-axis label in Plot

Anonymous User
Anonymous User
Posted 4 years ago

Hello,

I am able to add f[t] as an y-axis label and it works beautifully. However, if I try f[r,t], the code crashes. I don't want to use quotes cause it doesn't put the label in italics. Any ideas?

Plot[{f[1/8, t], f[1/4, t], f[3/8, t], f[1/2, t], f[5/8, t], 
  f[3/4, t], f[7/8, t]}, {t, 0, 15}, AxesLabel -> {t, f[t]}]

Attached the result (this is a plot of the zeta function for different real parts: 1/2 is the middle curve):

Attachment

Attachments:
POSTED BY: Anonymous User
14 Replies
Posted 4 years ago

Jose,

For publication quality plots take a look at Szabolcs Horvát's MaTeX package and Mark Caprio's SciDraw package.

WL uses ColorData[97, "ColorList"] by default. To see the other available indexed color options

ColorData["Indexed"] // Map[(# -> ColorData[#, "ColorList"] &), #] & //
   Partition[#, UpTo[2]] & // Grid[#, Alignment -> Left] &

I made an attempt at reading your paper, but quickly realized it would take me a while to understand. Will make another attempt when I have more time.

POSTED BY: Rohit Namjoshi
Anonymous User
Anonymous User
Posted 4 years ago

Thank you, Rohit. I am changing my mind by the minute, lol.

How can I specify colors for say 7 curves in a plot (not pairwise this time)? Do I need to use Riffle as well? At this I'm getting overwhelmed with so many curves in a single plot.

POSTED BY: Anonymous User
Posted 4 years ago

Riffle is used to create the pairs of duplicated colors. If you not need that then just specify a list of colors explicitly using a named color {Red, LightGreen, ...}, or RGBColor, or use one of the built-in indexed color lists that I showed in an earlier reply. e.g. to use the default WL colors

PlotStyle -> ColorData[97, "ColorList"]]
POSTED BY: Rohit Namjoshi
Anonymous User
Anonymous User
Posted 4 years ago

Perfect, I already incorporated those suggestions. Thanks so much

POSTED BY: Anonymous User
Posted 4 years ago

Something like this?

ClearAll@f
f[s_, t_] := s*t*Sin[t]
colors = {Red, Green, Blue};

Plot[{f[1/8, t], f[1/4, t], f[3/8, t], f[1/2, t], f[5/8, t], f[3/4, t], f[7/8, t]}, {t, 0, 15}, 
 PlotStyle -> Riffle[colors, colors]]

enter image description here

POSTED BY: Rohit Namjoshi
Anonymous User
Anonymous User
Posted 4 years ago

Wow, exactly. Let me try this, this will make my final graph pretty cool. I'm using it in a paper on the zeta function.

PS - I wonder how you were able to manage to imitate my curves and recolor them, Lol.

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 4 years ago

Hi Rohit, what if I had say 7 pairs with the same color, and one extra line. Should I place the line last, will it work?

POSTED BY: Anonymous User
Posted 4 years ago

Hi Jose,

If you have N curves and the length of the PlotStyle list of colors is less than N, then the color list will repeat from the beginning. If you do not want it to repeat, append another color. So in your case the list should be 7 pairs of colors followed by the color for the last curve

{c1, c1, c2, c2, c3, c3, c4, c4, c5, c5, c6, c6, c7, c7, c8}
POSTED BY: Rohit Namjoshi
Posted 4 years ago

Sure

Defer[f[r, t] - 2 t]

Any Style can also be applied e.g.

Style[Defer[f[r, t] - 2 t], 18, Bold, Blue, FontFamily -> "Times New Roman"]

So a string can also be used, but the appearance will be a little different from using Defer or TraditionalForm e.g.

Style["f(r,t) - 2t]", 18, Bold, Blue, FontFamily -> "Times New Roman", FontSlant -> Italic]
POSTED BY: Rohit Namjoshi
Anonymous User
Anonymous User
Posted 4 years ago

Perfect!

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 4 years ago

Rohit, is it possible to force curves, 2 by 2, to have the same color? Reason why I'm asking is cause I want to have 14 curves in the same graph! There are two equations for each one of 7 r parameters.

POSTED BY: Anonymous User
Posted 4 years ago

Hi Jose,

The problem is that f[x] is being evaluated. Try

AxesLabel -> {t, Defer@f[r, t]}
POSTED BY: Rohit Namjoshi
Anonymous User
Anonymous User
Posted 4 years ago

Perfect, exactly what I needed. Thank you!

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 4 years ago

Is it possible to have something like f(r,t)-2t in italics as well?

POSTED BY: Anonymous User
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard