Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: plot legend with filling

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126968] Re: plot legend with filling
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Thu, 21 Jun 2012 05:17:26 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201206200750.DAA04977@smc.vnet.net>

Needs["PlotLegends`"];

ListPlot[{v1, v2},
    Frame -> True,
    Axes -> False,
    Filling -> Axis,
    PlotStyle -> {
        {AbsolutePointSize[6], Red},
        {AbsolutePointSize[6], Blue}},
    FillingStyle -> {
        1 -> Directive[AbsoluteThickness[4], Blue],
        2 -> Directive[AbsoluteThickness[4], Red]},
    PlotLegend -> {"v1", "v2"},
    LegendPosition -> {-0.75, 0.25},
    LegendSize -> 0.3,
    LegendShadow -> None]


Bob Hanlon


On Jun 20, 2012, at 3:50 AM, Francisco Gutierrez <fgutiers2002 at yahoo.com> wrote:

>
> 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
>



  • Prev by Date: Re: altering each member of a list that matches a certain pattern
  • Next by Date: Re: altering each member of a list that matches a certain pattern
  • Previous by thread: plot legend with filling
  • Next by thread: Re: plot legend with filling