Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Does anyone know how to make a two data plot such that one of the data samples is showed as the volume transactions in TradingChart function? Thanks.

EDIT: Sorry the english. So, I have two data samples. I want to plot one of them in a ordinary plot using, for example, ListLinePlot, but the second data sample to be showed bellow in the same way the volume is ploted in TradingChart.

enter image description here

EDIT2: In resume I have 2 data samples. I want the first to be ploted in the main graph, and the second bellow.

EDIT3:

Data1 = {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}, {7, 1}, {8, 4}, {9, 6}, {10, 4}, {11, 5}, {12, 4}, {13, 6}, {14, 11}, {15, 6}, {16, 9}, {17, 15}, {18, 18}, {19, 24}, {20, 5},{21, 9}, {22, 8}, {23, 15}, {24, 12}, {25, 12}, {26, 8}, {27, 6}, {28, 0}, {29, 0}, {30, 1}, {31, 0}, {32, 0}, {33, 8}, {34, 3}, {35, 6}, {36, 1}, {37, 1}, {38, 1}, {39, 0}, {40, 0},{41, 0}, {42, 0}, {43, 0}, {44, 0}, {45, 0}, {46, 0}, {47, 0}, {48, 0}, {49, 0}, {50, 0}, {51, 0}};


Data2 = {{0, 2.509410662937836}, {1, 2.4808803466341955}, {2, 2.540569347654955}, {3, 2.547132749506656}, {4, 2.5608766053468215}, {5, 2.581673613536808}, {6, 2.604984165739864},{7, 2.6278553420965545}, {8, 2.6503872000749418}, {9, 2.6752177853363124}, {10, 2.7057947186702784}, {11, 2.745031662921106}, {12, 2.7943757324055767}, {13, 2.853013933116065},{14, 2.917745974429515}, {15, 2.983839933241766}, {16, 3.0465660811621076}, {17, 3.102516932682284}, {18, 3.1500203982948363}, {19, 3.188703244889767}, {20, 3.218713885646367},{21, 3.240043336569459}, {22, 3.252119187906068}, {23, 3.2536542495812055}, {24, 3.242674122710854}, {25, 3.2167232385868556}, {26, 3.17342632177792}, {27, 3.1117145450146624},{28, 3.0337272881633637}, {29, 2.9463165559593465}, {30, 2.860119427488097}, {31, 2.7856903736887726}, {32, 2.72960093847454}, {33, 2.693619848357109}, {34, 2.676505085841342},{35, 2.675912875804714}, {36, 2.688928643855797}, {37, 2.711270365853601}, {38, 2.7362623567711375}, {39, 2.7552236175724216}, {40, 2.760135480832154}, {41, 2.7472510017985674},{42, 2.7188819751432343}, {43, 2.6851673012886823}, {44, 2.6583557887909524}, {45, 2.640803683563485}, {46, 2.632087208191991}, {47, 2.6237017095679587}, {48, 2.59890527467275};
share|improve this question
    
I don't get it. "such as that one" = ? –  Öskå Aug 6 at 13:57
    
Sorry the English. Edited. –  Miguel Aug 6 at 14:03
1  
You should provide code for what you are trying to do. –  Öskå Aug 6 at 14:05
    
Sorry, but I have no code. I'm trying to find a way to plot just like TradingChart, but using numerical data. –  Miguel Aug 6 at 14:09
1  
Then provide the data? –  Öskå Aug 6 at 14:10

2 Answers 2

Using your example data:

d1 = Drop[Data1, -3]; (* to equalize length of the two series *)
d2 = Last /@ Data2;

p1 = ListLinePlot[d1,
   Frame -> True,
   GridLines -> Automatic,
   ImageSize -> 600];

p2 = BarChart[d2,
   BarSpacing -> 0.5,
   PlotRange -> {{1, Automatic}, {2., Automatic}},
   AspectRatio -> 1/5,
   Frame -> True,
   ImageSize -> 600,
   GridLines -> Automatic,
   ChartStyle -> RGBColor[0.36, 0.50, 0.70],
   PlotRangeClipping -> True];

Grid[{{p1}, {p2}}]

enter image description here

share|improve this answer
    
Thank you very much! –  Miguel Aug 6 at 22:11
    
@Miguel - Your are welcome. I manipulated your question a little bit by taking away the last three elements of your first series. IF both series always have differing lengths, please let me know. –  eldo Aug 6 at 22:24
    
Yes, you are right! There is some missing data. Probably lost them with the copy-paste... Thanks. –  Miguel Aug 6 at 23:21

With the data

data1={{0,0},{1,0},{2,0},{3,0},{4,0},{5,0},{6,0},{7,1},{8,4},{9,6},{10,4},{11,5},{12,4},{13,6},{14,11},{15,6},{16,9},{17,15},{18,18},{19,24},{20,5},{21,9},{22,8},{23,15},{24,12},{25,12},{26,8},{27,6},{28,0},{29,0},{30,1},{31,0},{32,0},{33,8},{34,3},{35,6},{36,1},{37,1},{38,1},{39,0},{40,0},{41,0},{42,0},{43,0},{44,0},{45,0},{46,0},{47,0},{48,0},{49,0},{50,0},{51,0}};
data2={{0,2.509410662937836},{1,2.4808803466341955},{2,2.540569347654955},{3,2.547132749506656},{4,2.5608766053468215},{5,2.581673613536808},{6,2.604984165739864},{7,2.6278553420965545},{8,2.6503872000749418},{9,2.6752177853363124},{10,2.7057947186702784},{11,2.745031662921106},{12,2.7943757324055767},{13,2.853013933116065},{14,2.917745974429515},{15,2.983839933241766},{16,3.0465660811621076},{17,3.102516932682284},{18,3.1500203982948363},{19,3.188703244889767},{20,3.218713885646367},{21,3.240043336569459},{22,3.252119187906068},{23,3.2536542495812055},{24,3.242674122710854},{25,3.2167232385868556},{26,3.17342632177792},{27,3.1117145450146624},{28,3.0337272881633637},{29,2.9463165559593465},{30,2.860119427488097},{31,2.7856903736887726},{32,2.72960093847454},{33,2.693619848357109},{34,2.676505085841342},{35,2.675912875804714},{36,2.688928643855797},{37,2.711270365853601},{38,2.7362623567711375},{39,2.7552236175724216},{40,2.760135480832154},{41,2.7472510017985674},{42,2.7188819751432343},{43,2.6851673012886823},{44,2.6583557887909524},{45,2.640803683563485},{46,2.632087208191991},{47,2.6237017095679587},{48,2.59890527467275},{49,2.6851673012886823},{50,2.6237017095679587},{51,2.640803683563485}}

the combination of a ListLinePlot and a Histogram-like or BarChart-like plot can be achieved with:

GraphicsColumn[{
  ListLinePlot[data1, PlotRange -> All, Frame -> True],
  ListPlot[data2, Frame -> True, Filling -> Axis, PlotMarkers -> \[HorizontalLine],   FillingStyle -> AbsoluteThickness[5]]
 }]

simpleCombination

For proper alignment, adjusted spacing and modified AspectRatio this can be expanded to

GraphicsColumn[{
  ListLinePlot[data1, PlotRange -> All, Frame -> True, ImageSize -> 500, ImagePadding -> {{46, 29.5}, {0, 2}}],
  ListPlot[data2, PlotRange -> All, Frame -> True, Filling -> Axis, PlotMarkers -> \[HorizontalLine], FillingStyle -> AbsoluteThickness[5], AspectRatio -> 1/5, ImageSize -> 500, ImagePadding -> {{17, 0.9}, {15, 0}}]
 }, Spacings -> -125]

enter image description here

share|improve this answer
    
Very nice! Many thanks. –  Miguel Aug 6 at 22:10
    
@Miguel Please be aware that my data2 is your Data2 with some random points added at the end. I did this, because I had to assume that these got lost when you copied the data into your question. –  Karsten 7. Aug 6 at 22:15
    
Yes, you are right! There is some missing data. Probably lost them with the copy-paste... Thanks. –  Miguel Aug 6 at 23:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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