7

I've always loved Math SE's [visualization] tag, and posts like Visually stunning math concepts which are easy to explain. Some people learn best visually. Other SE's like Math Educators and Chemistry don't have this tag, but doubtless they both use images.

  1. So how can I see a list of answers, ordered by votes, that comprise at least one picture?

  2. Is it possible to sort by a second criterion : the number of text in that answer? Then I can see which posts with at least one picture has the least and most accompanying text.

5
1

Here is another SEDE query.

I take a slightly different approach. Instead of searching in the html (that is found in the Posts.body field) I use the actual markdown as source. This is more complicated (and performs worse) because the PostHistory table contains all revisions of a post, not only the latest one. So I do some juggling to find the last revision. In that text I use the same technique Glorfindel used: a Like statement but I look for the ![ ][ ] markdown. Instead of length of the text I added a rough estimate of the word count.

To keep SEDE happy I do a TOP 1000.

select top 1000
       a.id as [Post Link]
     , a.creationdate
     , a.score
     , len(text)-len(replace(text,' ','')) [~ word count]
from posts a
inner join posts q on q.id = a.parentid
inner join (
select postid, 
       text
from posthistory phi
where id = (select max(id) 
            from posthistory ph
            where ph.postid = phi.postid
            and ph.posthistorytypeid in (2,5,8))
) md on md.postid = a.id
where a.posttypeid = 2 -- answers
and (
  md.text like '%![[]%][[]%]%' 
  --or 
  --md.text like '%![%](%)%' or 
  --md.text like '%<img src="%"%'
  )
order by 4 desc

This is what the result looks like:

result with answers and word count

Keep in mind SEDE is updated once a week on Sunday.
Use the fine SEDE Tutorial written by the admirable Monica Cellio.
Say "Hi" in SEDE chat.

5

The best results you'll probably get with SEDE, since it should allow for your second criterion (sorting by length of the post).

But for the first part, you can use a search: [visualization] url:"*.jpg*" is:a to find answers within the visualization tag that have an image, then sort the results by votes.

Like Martin said in the comments under your question, to find as many answers as possible you might want to search for multiple urls, containing imgur, png, jpg and gif.

5
+100

Here is a SEDE query listing all answers with at least one image. Figuring out how much text an answer has is too hard (at least for me) so I settled for the total length of the answer which should give a good indication.

Note that SEDE is updated only once a week, on Sunday morning, and currently it has some availability problems. Also, searching the full Posts table like this probably doesn't work on larger sites like Mathematics; it does work for Chemistry and Mathematics Educators. You might need to fork the query e.g. to limit your search to certain tags, minimum score or posting date. Check out the awesome tutorial if you're new to SEDE or SQL in general.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .