Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10561 > unrolled thread

Re: plot legend with filling

Started by"djmpark" <djmpark@comcast.net>
First post2012-06-21 09:18 +0000
Last post2012-06-21 09:18 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: plot legend with filling "djmpark" <djmpark@comcast.net> - 2012-06-21 09:18 +0000

#10561 — Re: plot legend with filling

From"djmpark" <djmpark@comcast.net>
Date2012-06-21 09:18 +0000
SubjectRe: plot legend with filling
Message-ID<jruosk$fj0$1@smc.vnet.net>
This can easily be done with the Presentations Application.

Needs["Presentations`Master`"] 

Presentations`Master` automatically loads PlotLegends` with a DeclarePackage
statement.

v1 = {{1.15, 0}, {1.15, 3}, {2.15, 1}, {2.15, 7}, {3.15, 3}, {3.15, 
    9}, {4.15, 5}, {4.15, 7}};
v2 = {{1, 1}, {1, 5}, {2, 1.8}, {2, 6}, {3, 3.5}, {3, 10}, {4, 4}, {4,
     6}}; 

ShowLegend[
 Draw2D[
  {ListDraw[v1, Filling -> Axis, 
    FillingStyle -> Directive[AbsoluteThickness[4], Blue]],
   ListDraw[v2, Filling -> Axis, 
    FillingStyle -> Directive[AbsoluteThickness[2], Red]]},
  AspectRatio -> 1/GoldenRatio,
  PlotRange -> {{-0.1, 5}, {-0.2, 12}},
  Axes -> True],
 
 {{{Blue, "Array 1"},
   {Red, "Array 2"}},
  LegendPosition -> {-0.8, 0.3},
  LegendSize -> {0.5, 0.2},
  LegendTextOffset -> {-0.6, 0},
  LegendSpacing -> 0.6},
 BaseStyle -> {FontSize -> 12, FontWeight -> "Bold"}] 



David Park
djmpark@comcast.net 
http://home.comcast.net/~djmpark/index.html 


From: Francisco Gutierrez [mailto:fgutiers2002@yahoo.com] 



Dear group:
I have two arrays of numbers, think of something like this: 
v1={{1.15,0},{1.15,3},{2.15,1},{2.15,7},{3.15,3},{3.15,9},{4.15,5},{4.15,7}}
v2={{1,1},{1,5},{2,1.8},{2,6},{3,3.5},{3,10},{4,4},{4,6}}

I want to make a graph with these two arrays, where I get:
a. A line from the x axis to each point in each array b. A legend, with say
v1 red and v2  blue c. Each array has its own filling style (different
color, thickness, etc.).

The problem is that I can find ways of plugging in two of these
characteristics, but not all three. For example: 
<<PlotLegends`
p1=ListPlot[v1,  Filling->Axis,
FillingStyle->Directive[AbsoluteThickness[4], Blue]] p2=p2=ListPlot[v2,
Filling->Axis, FillingStyle->Directive[AbsoluteThickness[4], Red]]
Show[p1,p2], but then I did not manage to find the way of using Show and
PlotLegend at the same time.

Or I can put both arrays into a Listplot command, but then I did not find
how to attribute a different color AND thickness to the filling of each
array.
I'm using Mathematica 8
Can somebody help me?

Francisco

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web