Message Boards Message Boards

0
|
2537 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Aligning the horizontal axis of a combination chart

I have some data that I need to draw ListLinePlot and BarChart separately and then combine them. My question is how to combine and align the horizontal axis correctly.

data = Table[{RandomInteger[{1, 200}], RandomReal[{0.3, 0.8}], i}, {i,
     0.3, 30, 0.3}];
Column[{ListLinePlot[data[[All, {3, 2}]], PlotRange -> All, 
   ImageSize -> Medium], 
  BarChart[data[[All, 1]], ImageSize -> Medium, AspectRatio -> 1/8]}, 
 Alignment -> Center]

enter image description here

POSTED BY: Tsai Ming-Chou
2 Replies
Posted 3 years ago

Maybe something like this?

ResourceFunction["CombinePlots"][
 BarChart[data[[All, 1]],
  Frame -> True,
  PlotRange -> All,
  ImageSize -> Medium],
 ListLinePlot[data[[All, 2]],
  Frame -> True,
  PlotRange -> All,
  ImageSize -> Medium],
 "AxesSides" -> "TwoY"]

enter image description here

POSTED BY: Rohit Namjoshi

I know CombinePlots! However, I still need some way to separate the two charts! Until now, I did not find the related examples in the forums or documentation centers~~ But thank you a lot for your response~~~

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

Group Abstract Group Abstract