matlab live link: mphplot produces no legend

Please login with a confirmed email address before reporting spam

The following code with mphplot(model,'pg1') plots 2 lines in a figure properly but doesn't show the legend. What's the problem?

model.result.create('pg1', 'PlotGroup1D'); model.result('pg1').create('lngr1', 'LineGraph'); model.result('pg1').feature('lngr1').set('xdata', 'expr'); model.result('pg1').feature('lngr1').selection.set([1]);

model.result('pg1').set('looplevelinput', {'manual'}); model.result('pg1').set('looplevel', {'1, 101'}); model.result('pg1').set('xlabel', 'x-coordinate (m)'); model.result('pg1').set('ylabel', 'Dependent variable u (1)'); model.result('pg1').set('legendpos', 'lowermiddle'); model.result('pg1').set('xlabelactive', false); model.result('pg1').set('ylabelactive', false); model.result('pg1').feature('lngr1').label('Line Graph'); model.result('pg1').feature('lngr1').set('xdataexpr', 'x'); model.result('pg1').feature('lngr1').set('xdataunit', 'm'); model.result('pg1').feature('lngr1').set('xdatadescr', 'x-coordinate'); model.result('pg1').feature('lngr1').set('linemarker', 'point'); model.result('pg1').feature('lngr1').set('markerpos', 'datapoints'); model.result('pg1').feature('lngr1').set('legend', true); model.result('pg1').feature('lngr1').set('resolution', 'norefine');


Reply

Please read the discussion forum rules before posting.

Please log in to post a reply.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.