-1

I would like create an plot with to display the last value on line. But i can not create the plot with the last value on chart. Do you have an idea for to resolve my problem, thanks you !

Input : DataFrame Plot

Output : Cross = Last Value In columns Output Final

# import eikon as ek
  import matplotlib.pyplot as plt
  import seaborn as sns
  import pandas as pd
  import numpy as np
  import os

  import seaborn as sns; sns.set()
  import pylab
  from scipy import *
  from pylab import *

  fichier =  "P:/GESTION_RPSE/GES - Gestion Epargne Salariale/Dvp Python/Florian/Absolute 
  Performance/PLOT.csv"
  df = pd.read_csv(fichier)
  df = df.drop(columns=['Unnamed: 0'])

  # sns.set()
  plt.figure(figsize=(16, 10))
  df = df.melt('Date', var_name='Company',  value_name='Value')
  #palette = sns.color_palette("husl",12)
  ax = sns.lineplot(x="Date", y="Value", hue='Company', data=df).set_title("LaLaLa")


  plt.show()
Flo Cp
  • 281
  • 2
  • 13
  • If you want to add an x at the end of your lines, there are many ways to go about it in addition to the one I proposed as an answer. But it would help if you could provide a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) that includes a toy dataset (refer to [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples)) – Diziet Asahi Dec 11 '19 at 12:44

1 Answers1

0

Do you just want to put an 'X' at the end of your lines?

If so, you could pass markerevery=[-1] to the call to lineplot(). However there are a few caveats:

  • You have to use style= instead of hue= otherwise, there are no markers drawn
  • Filled markers work better than unfilled markers (like "x"). You can just use markers=True to use the default markers, or pass a list markers=['s','d','o',etc...]

code:

fmri = sns.load_dataset("fmri")
fig, ax = plt.subplots()
ax = sns.lineplot(x="timepoint", y="signal",
                  style="event", data=fmri, ci=None, markers=True, markevery=[-1], markersize=10)

enter image description here

Diziet Asahi
  • 38,379
  • 7
  • 60
  • 75