Hello!
I have a nested table stocks with a dimension {8,9,1000,2} so I have 89 different data set that I want to plot. Let say, 8 is the number of business sectors, 9 is the total number of companies selected from each sector, and 10002 the change in stock price in 1000 days.
I also have the list of the names of the 8 different sectors called sectorNames. I want to ListPlot the first company of each sector, and label the graph of the company by the name of the sector:
According to the way I defined the nested list above, the stocks has a dimension {8,9,1000,2} and the outer list with 8 submit is the sectorNames. As a result, when I plot
I should have the name of sector as the legends for the plots with the same order as the order they are used in the stocks. However, this is not the case and the legends does not match the graph names.
If you intended to plot sectors and not companies, how do you take the data for, say 3 companies, and plot that as one sector? Is it three separate curves with the same color? three curves different colors?
My recommendation is for you to look at using Dataset[] for your stocks (documentation here). Then you can make queries like get all the stocks is a certain sector. Your plotting commands will become less cryptic.
Thanks for your advice on how to post on the forum. I found your suggestion about using the Dataset really helpful.
What I wanted to was to plot the data of the first company in each sector; something like this
I did not realize that your companies operate in every sector.
Comment #1: you never need the [[;;]] in any of the plot commands. I copied them from your post but they are unnecessary.
Comment #2: Here is the answer but now you will see why Dataset[] is significantly easier to understand. You need to transpose your dimensions in order to change from plotting by sector to plotting by company: