5
$\begingroup$

I have formatting problem that I can't figure out. I'm trying to remove the tick marks on a paired histogram without removing the numbers. The trick with other plots is to make the opacity of the tick marks zero and specify the font opacity as one:

TicksStyle -> Directive[12, Opacity[0], FontOpacity -> 1]

However, when I attempt this with a paired histogram it makes both the ticks and numbers hidden. This is the full code for the histogram (currently with opacity at 1):

 PairedHistogram[{d1, d2} , {nd1, nd2}, PlotTheme -> "Monochrome", AxesLabel 
 -> {HoldForm[Frequency], HoldForm[EG]}, ChartLabels -> {"(a)", "(b)"}, 
 PlotLabel -> "1963-1972",  LabelStyle -> {FontFamily -> "Baghdad", 
 GrayLevel[0]}, ChartLegends -> Placed[{"1963", "1972"}, Right],  ChartStyle 
 -> {{EdgeForm[Black], EdgeForm[Black]}, {EdgeForm[Black], EdgeForm[Black]}}, 
 TicksStyle -> Directive[12, Opacity[1], FontOpacity -> 1]]

Which produces:

Paired Histogram

I've also tried something like:

TicksStyle -> {{Directive[12, Opacity[0], FontOpacity -> 1]},{Directive[12,
Opacity[0], FontOpacity -> 1]}}

Which doesn't seem to solve this issue. Finally, exporting the file as an eps and editing it in illustrator doesn't work because it looks different than when you export it as a PDF/PNG/etc. or look at the histogram within mathematica (something is wrong with the eps exporter).

Any suggestions?

$\endgroup$

1 Answer 1

5
$\begingroup$
nd1 = d1 = RandomVariate[NormalDistribution[0, 0.1], 500];
nd2 = d2 = RandomVariate[NormalDistribution[0, 0.1], 500];

g = PairedHistogram[{d1, d2}, {nd1, nd2}, PlotTheme -> "Monochrome", 
  AxesLabel -> {HoldForm[Frequency], HoldForm[EG]}, 
  ChartLabels -> {"(a)", "(b)"}, PlotLabel -> "1963-1972", 
  LabelStyle -> {FontFamily -> "Baghdad", GrayLevel[0]}, 
  ChartLegends -> Placed[{"1963", "1972"}, Right], 
  ChartStyle -> {{EdgeForm[Black], EdgeForm[Black]}, {EdgeForm[Black],
      EdgeForm[Black]}}, TicksStyle -> Directive[12, Opacity[0]]]

Mathematica graphics

Replacing the invisible text with a replacement rule:

g /. {
  {Directive[Opacity[0]], Text[a__]} :> {Directive[Opacity[1]], 
    Text[a]},
  {Style[{a__},  
     Directive[Opacity[0]], {Directive[Opacity[0]], 
      Directive[Opacity[0]]}], 
     Style[{b__},   
     Directive[Opacity[0]], {Directive[Opacity[0]], 
      Directive[Opacity[0]]}]} :> {Style[{a},  
     Directive[Opacity[1]], {Directive[Opacity[1]], 
      Directive[Opacity[1]]}], 
     Style[{b},   
     Directive[Opacity[1]], {Directive[Opacity[1]], 
      Directive[Opacity[1]]}]}
  }

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ Thank you for the this! It worked perfectly. $\endgroup$
    – tazz_ben
    Oct 29, 2015 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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