# Additional line styles - comparison excel chart

Hey everybody,

Before I made the change to matplotlib I used to do my charts in MS
Excel 2007. I have been using matplotlib for a while now but haven't
been able to replicate my graphs in the same beauty (for an example
see the attachment).

1) Can I generate additional line styles beyond [ ‘-‘ | ‘–’ | ‘-.’ |
‘:’ | ‘steps’ | ...]? For example the empty line for value 9 in the
chart would be very nice to have.
2) The coloring and the way the lines curve around looks very nice to
me. I remember that the Excel charts did not have this nice look
before Excel 2007. Can I achieve similar effects with matplotlib? I'm
not really sure what creates this nice look, so this question is of
course a little fuzzy.

These questions are not meant as a criticism. I enjoy using matplotlib
and I am very grateful this amazing tool has been developed. The latex
integration is a clear advantage over excel. If matplotlib becomes
equal or better in look to excel charts the incentives for excel users
to convert will be even stronger.

Thanks for any answers/thoughts,

Benjamin

Maybe you are thinking about the smoothness of the curves. Even you
have spaced points, they don't do sharp edges. In my opinion, for
scientific research, they shouldn't be concealed in the general case,
and this is, I think, the main target of MPL.

Nevertheless, if in your case it makes sense and you want them to be
smooth, you can do it through SciPy, applying a interpolation scheme.

tck=scipy.interpolate(datax, datay)
datax_n=np.arange(datax.min(), datax.max(), len(datax)*20)
datay_n=sicpy.interpolate(splev(datax_n,tck,der=0)

And then you plot datax_n and datay_n.

http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html#spline-interpolation-in-1-d-procedural-interpolate-splxxx

···

On Mon, Jul 16, 2012 at 11:09 AM, Benjamin Jonen <bjonen@...287...> wrote:

2) The coloring and the way the lines curve around looks very nice to
me. I remember that the Excel charts did not have this nice look
before Excel 2007. Can I achieve similar effects with matplotlib? I'm
not really sure what creates this nice look, so this question is of
course a little fuzzy.

Here is a quick example that might help you:

Nicolas

···

On Jul 16, 2012, at 11:27 , Daπid wrote:

On Mon, Jul 16, 2012 at 11:09 AM, Benjamin Jonen <bjonen@...287...> wrote:

2) The coloring and the way the lines curve around looks very nice to
me. I remember that the Excel charts did not have this nice look
before Excel 2007. Can I achieve similar effects with matplotlib? I'm
not really sure what creates this nice look, so this question is of
course a little fuzzy.

Maybe you are thinking about the smoothness of the curves. Even you
have spaced points, they don't do sharp edges. In my opinion, for
scientific research, they shouldn't be concealed in the general case,
and this is, I think, the main target of MPL.

Nevertheless, if in your case it makes sense and you want them to be
smooth, you can do it through SciPy, applying a interpolation scheme.

tck=scipy.interpolate(datax, datay)
datax_n=np.arange(datax.min(), datax.max(), len(datax)*20)
datay_n=sicpy.interpolate(splev(datax_n,tck,der=0)

And then you plot datax_n and datay_n.

http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html#spline-interpolation-in-1-d-procedural-interpolate-splxxx

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Hey guys,

thanks for your answers. Nicolas, your showcase seems to be exactly
what I'm after. To make this a little more user-friendly it would be
nice to create ones own line style from this so that it can be easily
incorporated in the plotting command, i.e. ax.plot( .... ,
linestyle=myFancyLine) .

Anyway thanks a lot for pointing out that this can be done in
matplotlib already.

Benjamin

···

On Mon, Jul 16, 2012 at 2:12 PM, Nicolas Rougier <Nicolas.Rougier@...3782...> wrote:

Here is a quick example that might help you:

Nicolas

On Jul 16, 2012, at 11:27 , Daπid wrote:

On Mon, Jul 16, 2012 at 11:09 AM, Benjamin Jonen <bjonen@...287...> wrote:

2) The coloring and the way the lines curve around looks very nice to
me. I remember that the Excel charts did not have this nice look
before Excel 2007. Can I achieve similar effects with matplotlib? I'm
not really sure what creates this nice look, so this question is of
course a little fuzzy.

Maybe you are thinking about the smoothness of the curves. Even you
have spaced points, they don't do sharp edges. In my opinion, for
scientific research, they shouldn't be concealed in the general case,
and this is, I think, the main target of MPL.

Nevertheless, if in your case it makes sense and you want them to be
smooth, you can do it through SciPy, applying a interpolation scheme.

tck=scipy.interpolate(datax, datay)
datax_n=np.arange(datax.min(), datax.max(), len(datax)*20)
datay_n=sicpy.interpolate(splev(datax_n,tck,der=0)

And then you plot datax_n and datay_n.

http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html#spline-interpolation-in-1-d-procedural-interpolate-splxxx

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users