1
$\begingroup$

I have five data sets that I'm throwing together in a ListLinePlot. Each data set corresponds to professor ratings per semester. One professor started a semester after everyone else. How do I add a placeholder point for Semester 1 so that their data is correctly placed? My code is below. Currently, I made profb's Semester 1 the same rating as Semester 2.

profa = {4.039, 3.588, 4.093, 3.722};
profb = {**3.733, 3.733**, 4.272, 4.118};
profc = {3.778, 3.626, 3.940, 4.425};
profd = {3.523, 3.837, 4.243, 3.995};
profe = {3.762, 3.575, 3.945, 4.210};

data = {profa, profb, profc, profd, profe};

dataplot = ListLinePlot[data,...]

If this question has been answered on another thread please direct me there! Thanks for your help.

$\endgroup$
2
$\begingroup$

In Mathematica, the convention is to replace missing data points with a call to Missing

profa = {4.039, 3.588, 4.093, 3.722};
profb = {Missing[], 3.733, 4.272, 4.118};
profc = {3.778, 3.626, 3.940, 4.425};
profd = {3.523, 3.837, 4.243, 3.995};
profe = {3.762, 3.575, 3.945, 4.210};
data = {profa, profb, profc, profd, profe};
dataplot = ListLinePlot[data]

plot

$\endgroup$
0
$\begingroup$

This seems to work

profa = {4.039, 3.588, 4.093, 3.722};
profb = {Null, Null, 4.272, 4.118};
profc = {3.778, 3.626, 3.940, 4.425};
profd = {3.523, 3.837, 4.243, 3.995};
profe = {3.762, 3.575, 3.945, 4.210};
data = {profa, profb, profc, profd, profe};
dataplot = ListLinePlot[data]

enter image description here

$\endgroup$
  • $\begingroup$ This is fine, but the 2nd Null should be 3.733. $\endgroup$ – m_goldberg Aug 1 '17 at 22:51

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.