Mathematica: Obtaining graphics primitives and directives

旧时模样 提交于 2019-12-05 21:31:10

I read:

What I would like to obtain instead is a list of simple primitives, I do not want them inside Styles.

You can get it just by simple replacement:

First[ g2 /. Style[expr_, opts___] :> {opts, expr} ]

Now you write:

Here is one attempt obtaining only the lines and colors

Knowing the internal structure of g2 it is simple to extract only Line objects with its colors. It is even simpler because all Lines are wrapped with Style:

tmp3 = Cases[g2, 
   Style[{lines__Line}, ___, color_RGBColor, ___] :> {color, lines}, 
   Infinity];
Graphics[tmp3]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!