2
$\begingroup$

Simple plotting question: I'd like to keep the base style of the "Business" theme, but with two slight modifications:

  • Use CapForm to round the ends of my plot curve
  • Override the Frame option so I have a y axis frame too

Here's the code:

bceLoss = -(#Target*Log[#Input] + (1 - #Target)*Log[1 - #Input]) &;
Plot[Evaluate@bceLoss[<|"Input" -> p, "Target" -> 1|>], {p, 0, 1}, 
 FrameLabel -> {"Probability of Ground Truth Class", "Loss"}, 
 Frame -> {{True, False}, {True, False}}, PlotTheme -> "Business"]

enter image description here

$\endgroup$
  • $\begingroup$ PlotStyle -> CapForm["Round"] works for me. I don't know how to force the Frame. $\endgroup$ – Szabolcs May 16 '18 at 18:20
3
$\begingroup$

As mentioned in a comment, PlotStyle -> CapForm["Round"] will take care of that requirement.

For the frame, you can combine the "Business" theme with "FullAxes" by enclosing them in a list:

bceLoss = -(#Target*Log[#Input] + (1 - #Target)*Log[1 - #Input]) &;
Plot[Evaluate@bceLoss[<|"Input" -> p, "Target" -> 1|>], {p, 0, 1}, 
 FrameLabel -> {"Probability of Ground Truth Class", "Loss"}, 
 PlotStyle -> CapForm["Round"], PlotTheme -> {"Business", "FullAxes"}]

enter image description here

$\endgroup$
2
$\begingroup$

You can find the Frame and FrameStyle settings associated with the "Business" theme using

{Frame, FrameStyle} /. Charting`ResolvePlotTheme["Business", Plot]

{{{True, False}, {True, False}},
{{StrokeForm[Opacity[0]], StrokeForm[Opacity[0]]}, {Automatic, None}}}

So, you need to override the FrameStyle set by the PlotTheme by using, say,

FrameStyle -> {{Opacity[1], Automatic}, {Automatic, Automatic}}

to get (after adding PlotStyle -> CapForm["Round"] as suggested by Szabolcs):

enter image description here

$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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