|
302 | 302 |
|
303 | 303 | %% Plotting starts here: |
304 | 304 |
|
| 305 | +% For plotting, it's useful to know whether we're running in old or new |
| 306 | +% Matlab graphics mode |
| 307 | +if ( is_octave() || ~verLessThan('matlab', '8.4') ) |
| 308 | + newGraphicsMode = true; |
| 309 | +else |
| 310 | + newGraphicsMode = false; |
| 311 | +end |
| 312 | + |
305 | 313 | % Acquire initial color cycle if running R2014b+. |
306 | | -if ( ~compatible_verLessThan('matlab', '8.4') ) |
| 314 | +if ( newGraphicsMode ) |
307 | 315 | if ( ~holdState ) |
308 | 316 | set(gca, 'ColorOrderIndex', 1); |
309 | 317 | end |
|
318 | 326 | hold on |
319 | 327 |
|
320 | 328 | % Get color cycle prior to point plot if running R2014b. |
321 | | -if ( ~compatible_verLessThan('matlab', '8.4') ) |
| 329 | +if ( newGraphicsMode ) |
322 | 330 | newColorOrder = get(gca, 'ColorOrderIndex'); |
323 | 331 | set(gca, 'ColorOrderIndex', originalColorOrder) |
324 | 332 | end |
|
333 | 341 | end |
334 | 342 |
|
335 | 343 | % Reset color cycle prior to jump plot if running R2014b. |
336 | | -if ( ~compatible_verLessThan('matlab', '8.4') ) |
| 344 | +if ( newGraphicsMode ) |
337 | 345 | set(gca, 'ColorOrderIndex', originalColorOrder); |
338 | 346 | end |
339 | 347 |
|
|
366 | 374 | end |
367 | 375 |
|
368 | 376 | % Reset colors prior to legend data plot if running R2014b. |
369 | | -if ( ~compatible_verLessThan('matlab', '8.4') ) |
| 377 | +if ( newGraphicsMode ) |
370 | 378 | set(gca, 'ColorOrderIndex', originalColorOrder); |
371 | 379 | end |
372 | 380 |
|
|
387 | 395 | end |
388 | 396 |
|
389 | 397 | % Reset colors prior to legend data plot if running R2014b. |
390 | | -if ( ~compatible_verLessThan('matlab', '8.4') ) |
| 398 | +if ( newGraphicsMode ) |
391 | 399 | set(gca, 'ColorOrderIndex', newColorOrder); |
392 | 400 | end |
393 | 401 |
|
|
445 | 453 | %PLOTDELTAS Plots delta functions. |
446 | 454 | h = []; |
447 | 455 |
|
| 456 | + if ( is_octave() || ~verLessThan('matlab', '8.4') ) |
| 457 | + newGraphicsMode = true; |
| 458 | + else |
| 459 | + newGraphicsMode = false; |
| 460 | + end |
| 461 | + |
448 | 462 | % Get and save the current ColorOrder if running on R2014a or earlier. |
449 | | - if ( compatible_verLessThan('matlab', '8.4') ) |
| 463 | + if ( ~newGraphicsMode ) |
450 | 464 | originalColorOrder = get(gca, 'ColorOrder'); |
451 | 465 | colorOrder = circshift(originalColorOrder, 1); |
452 | 466 | end |
453 | 467 |
|
454 | 468 | for k = 1:1:numel(deltaData) |
455 | 469 | % Set color for the next delta function plot. |
456 | | - if ( compatible_verLessThan('matlab', '8.4') ) |
| 470 | + if ( ~newGraphicsMode ) |
457 | 471 | % Manually manipulate the ColorOrder for R2014a or earlier. |
458 | 472 | colorOrder = circshift(colorOrder, -1); |
459 | 473 | set(gca, 'ColorOrder', colorOrder); |
|
466 | 480 | end |
467 | 481 |
|
468 | 482 | % Restore the ColorOrder if running on R2014a or earlier. |
469 | | - if ( compatible_verLessThan('matlab', '8.4') ) |
| 483 | + if ( ~newGraphicsMode ) |
470 | 484 | set(gca, 'ColorOrder', originalColorOrder); |
471 | 485 | end |
472 | 486 | end |
|
0 commit comments