9
$\begingroup$

You can style the axes in Plot with AxesStyle. For example, the following code makes the axes red.

Plot[Sin[x], {x, -3, 3}, Axes -> True, AxesStyle -> Red] 

I cannot seem to find a way to style the polar axes in PolarPlot. AxesStyle does not work and there is no PolarAxesStyle function. I was hoping to get this code below to work but it doesn't.

PolarPlot[θ, {θ, 0, 3 π}, PolarAxes -> True, AxesStyle -> Red] 

Is this a missing feature in Mathematica?

$\endgroup$
3
  • 2
    $\begingroup$ I do not know why it does not work. But Will this work for your? PolarPlot[θ, {θ, 0, 3 π}, BaseStyle -> Red, PolarAxes -> True] $\endgroup$ Commented Dec 12, 2015 at 7:21
  • $\begingroup$ Yes it does. Interesting... It would seem their naming scheme is not uniform. There must be a good reason for this... that I am not aware of. But it seems a little counterintuitive to me. Thank you! $\endgroup$ Commented Dec 12, 2015 at 7:25
  • 1
    $\begingroup$ According to help, I think it should have worked. It might be a bug. I do not know. May be someone else would know better what is going on. $\endgroup$ Commented Dec 12, 2015 at 7:27

2 Answers 2

11
$\begingroup$

AxesStyle modifies the Cartesian axes, not the polar ones:

PolarPlot[θ, {θ, 0, 4 Pi}, AxesStyle -> {Directive[Thick, Blue], Directive[16, Orange]} ] 

polar plot with colored Cartesian axes

I could not find a built-in way to modify the polar axes, so after taking a look at the structure of the Graphics object generated by PolarPlot, I came up with the following helper function that modifies the graphics primitives corresponding to axes, ticks, and labels on the polar axes.

By default:

  • If these features are not present, nothing happens to the plot even if options were selected;
  • If no options are specified, then the defaults output by PolarPlot will be left alone.

This is colorPolarAxes:

Clear[colorPolarAxes] Options[colorPolarAxes] = {PolarAxesStyle -> {}, PolarLabelsStyle -> {}, PolarTicksStyle -> {}}; colorPolarAxes[plot_Graphics, OptionsPattern[]] := ReplaceAll[plot, { Text[Style[lbl__, {}], pos__] :> Text[Style[lbl, OptionValue[PolarLabelsStyle]], pos], Style[Line[def__], {}] :> Style[Line[def], OptionValue[PolarTicksStyle]], Circle[options__] :> Style[Circle[options], OptionValue[PolarAxesStyle]] } ] 

Here is an example of its use:

colorPolarAxes[ PolarPlot[θ, {θ, 0, 4 Pi}, PolarAxes -> Automatic, PolarTicks -> {"Degrees", None}], PolarAxesStyle -> Orange, PolarLabelsStyle -> {Darker@Green, 14, Italic}, PolarTicksStyle -> {Blue, Thick} ] 

plot with colored polar axes, ticks and labels

$\endgroup$
1
  • 1
    $\begingroup$ Excellent, I remember scratching my head over this back when it was posted. $\endgroup$ Commented Feb 22, 2016 at 6:26
4
$\begingroup$
PolarPlot[\[Theta], {\[Theta], 0, 4 Pi}, PlotStyle -> Directive[Thickness[.006], Black], PolarGridLines -> Automatic, GridLinesStyle -> Directive[Dashed, Black], PolarAxes -> Automatic, PolarTicks -> {"Degrees", Automatic}, TicksStyle -> Directive[Blue, Thick, 14]] 

Try this once

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.