3
$\begingroup$

Here is a simple question. It has been strangely difficult to find the answer in the documentations, or anywhere.

Suppose I have a list of the following form:

over = {{{1,2,3},{1,4,3},{1,2,9},{1,3,5}}}

How do I make a ListLinePlot where

A: Every row of "over" is represented by a line in the same plot, and B: Every line has the same color (Red, say), and C: Each line is somewhat transparent?

Note that "over" actually contains many more lines than shown here. So, the solution should not require that each row be selected manually. My overall idea is the use the transparency of the lines to indicate more likely values through time (as lines cross).

Below is an image of my attempt. For some reason the colors change.

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ Try using PlotStyle -> Directive[ Orange, Opacity[0.3]]. In your code, you give PlotStyle a list of styles, and it cycles through them, so half the lines in your plot are orange and the other half have an opacity value. $\endgroup$
    – Jason B.
    Jul 2 '19 at 16:16
  • $\begingroup$ Your definition of over has an extra set of list brackets. Plot its first part. ListLinePlot[over[[1]], PlotStyle -> Opacity[0.5, Red]] $\endgroup$
    – Bob Hanlon
    Jul 2 '19 at 19:09
2
$\begingroup$

You can also use the two-argument form of Opacity; that is, use Opacity[op, col] to have the color col with opacity op.

ListLinePlot[over[[1]], 
 PlotStyle -> Directive[CapForm["Round"], Opacity[.5, Orange], 
   AbsoluteThickness[5]]]

enter image description here

Seedrandom[1]
data = RandomFunction[ARProcess[{.5, -.3}, .1], {1, 100}, 10];

ListLinePlot[data, PlotStyle -> Opacity[.5, Orange]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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